Основное
 
 
Отправитель Задача Язык Вердикт Время Память Отослано Протест.  
101410908 Дорешивание:
cornhub
920C - 69 C++17 (GCC 7-32) Полное решение 77 мс 724 КБ 2020-12-16 12:46:07 2020-12-16 12:46:07
→ Исходный код
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
     
    ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0); 	

ll int n,a; cin>>n;
string s,p; ll int maxx = 0;

for(int i=1;i<=n;i++)
{
cin>>a;	
maxx = max(a,maxx);
if(maxx==i) s.push_back('0'); else s.push_back('1');  // creating an optimal solution
}
s.pop_back(); // removing last element
cin>>p; bool flag = 1;
ll int j = 0;
for(auto x :p)  // checking if p is subset of s
{
if(s[j]=='1'&&x=='0')	
flag = 0;
j++;
}
if(flag) cout<<"YES";
else cout<<"NO";
}
?
Время: ? ms, память: ? КБ
Вердикт: ?
Ввод
?
Вывод участника
?
Ответ жюри
?
Комментарий чекера
?
Диагностика
?
Показать детали тестирования