#include<bits/stdc++.h>
#ifndef SKY
#include "Anna.h"
#endif // SKY
using namespace std;
#define N 100010
#define ll long long
#define ii pair<int,int>
#define fs first
#define sc second
#define pb push_back
#define iii pair<int,ii>
#ifdef SKY
void Send(int a)
{
cout<<a<<" ";
}
#endif // SKY
void Anna(int n, vector<char> s)
{
int vt=-1;
for(int i=0;i<n;i++)
if(s[i]=='X')
{
vt=i;
break;
}
if(vt==-1)
{
for(int i=0;i<n;i++)
Send(0);
return;
}
for(int i=0;i<vt;i++)
Send(0);
Send(1);
for(int i=vt+1;i<n;i++)
if(s[i]=='Z')
Send(1);
else Send(0);
}
#ifdef SKY
int main()
{
freopen("A.inp","r",stdin);
freopen("A.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
vector<char>s;
for(int i=1;i<=n;i++)
{
char ch;
cin>>ch;
s.pb(ch);
}
Anna(n,s);
return 0;
}
#endif // SKY
#include<bits/stdc++.h>
#ifndef SKY
#include "Bruno.h"
#endif // SKY
using namespace std;
#define N 100010
#define ll long long
#define ii pair<int,int>
#define fs first
#define sc second
#define pb push_back
#define iii pair<int,ii>
#ifdef SKY
void Remove(int d)
{
cout<<d<<" ";
}
#endif // SKY
void Bruno(int n,int L, vector<int> a)
{
if(*max_element(a.begin(),a.end())==0)
{
for(int i=0;i<n;i++)
Remove(i);
return;
}
int vt=-1;
for(int i=0;i<n;i++)
if(a[i]==1)
{
vt=i;
break;
}
int pos=vt+1;
for(int i=vt+1;i<n;i++)
if(a[i]==1)
{
//cout<<i<<endl;
for(int j=i-1;j>=pos;j--)
Remove(j);
Remove(i);
pos=i+1;
}
for(int i=pos;i<n;i++)
Remove(i);
for(int i=0;i<=vt;i++)
Remove(i);
}
#ifdef SKY
int main()
{
freopen("A.inp","r",stdin);
freopen("A.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
vector<int>a;
for(int i=1;i<=n;i++)
{
int u;
cin>>u;
a.pb(u);
}
Bruno(n,n,a);
return 0;
}
#endif // SKY
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
512 KB |
Output is correct |
2 |
Correct |
2 ms |
520 KB |
Output is correct |
3 |
Correct |
1 ms |
520 KB |
Output is correct |
4 |
Correct |
1 ms |
600 KB |
Output is correct |
5 |
Correct |
0 ms |
600 KB |
Output is correct |
6 |
Correct |
1 ms |
516 KB |
Output is correct |
7 |
Correct |
1 ms |
512 KB |
Output is correct |
8 |
Correct |
0 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
512 KB |
Output is correct |
10 |
Correct |
1 ms |
600 KB |
Output is correct |
11 |
Correct |
2 ms |
520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
51 ms |
7668 KB |
Partially correct |
2 |
Partially correct |
54 ms |
8092 KB |
Partially correct |
3 |
Partially correct |
53 ms |
8008 KB |
Partially correct |
4 |
Partially correct |
54 ms |
8092 KB |
Partially correct |
5 |
Partially correct |
53 ms |
8124 KB |
Partially correct |
6 |
Partially correct |
52 ms |
8140 KB |
Partially correct |
7 |
Partially correct |
53 ms |
8120 KB |
Partially correct |
8 |
Partially correct |
60 ms |
8080 KB |
Partially correct |
9 |
Partially correct |
63 ms |
8024 KB |
Partially correct |
10 |
Partially correct |
56 ms |
8092 KB |
Partially correct |
11 |
Partially correct |
53 ms |
8080 KB |
Partially correct |
12 |
Partially correct |
51 ms |
8020 KB |
Partially correct |
13 |
Partially correct |
64 ms |
8104 KB |
Partially correct |
14 |
Partially correct |
60 ms |
8088 KB |
Partially correct |
15 |
Partially correct |
54 ms |
8148 KB |
Partially correct |
16 |
Partially correct |
57 ms |
8080 KB |
Partially correct |
17 |
Partially correct |
62 ms |
8064 KB |
Partially correct |
18 |
Partially correct |
59 ms |
8096 KB |
Partially correct |
19 |
Partially correct |
56 ms |
8068 KB |
Partially correct |
20 |
Partially correct |
51 ms |
8024 KB |
Partially correct |
21 |
Partially correct |
53 ms |
8072 KB |
Partially correct |
22 |
Partially correct |
61 ms |
8036 KB |
Partially correct |
23 |
Partially correct |
51 ms |
8200 KB |
Partially correct |
24 |
Partially correct |
50 ms |
8076 KB |
Partially correct |
25 |
Partially correct |
61 ms |
8116 KB |
Partially correct |
26 |
Partially correct |
56 ms |
8076 KB |
Partially correct |
27 |
Partially correct |
57 ms |
8004 KB |
Partially correct |
28 |
Partially correct |
59 ms |
8204 KB |
Partially correct |
29 |
Partially correct |
61 ms |
8076 KB |
Partially correct |
30 |
Partially correct |
61 ms |
8080 KB |
Partially correct |
31 |
Partially correct |
59 ms |
8072 KB |
Partially correct |
32 |
Partially correct |
52 ms |
8064 KB |
Partially correct |
33 |
Partially correct |
51 ms |
8132 KB |
Partially correct |