Submission #714647

#TimeUsernameProblemLanguageResultExecution timeMemory
714647bin9638Ancient Machine (JOI21_ancient_machine)C++17
70 / 100
64 ms8204 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...