Submission #987350

#TimeUsernameProblemLanguageResultExecution timeMemory
987350lucriEditor (BOI15_edi)C++17
20 / 100
737 ms399068 KiB
#include <bits/stdc++.h> using namespace std; long long n,v[5010][5010],ans[5010]; int main() { cin>>n; for(int i=1;i<=n;++i) { cin>>v[i][0]; if(v[i][0]>0) { ans[i]=v[i][0]; for(int j=1;j<=n;++j) v[i][j]=i; continue; } int poz=v[i-1][-v[i][0]]; for(int j=1;j<=-v[i][0];++j) v[i][j]=v[poz-1][j]; for(int j=-v[i][0]+1;j<=n;++j) v[i][j]=i; ans[i]=ans[poz-1]; } for(int i=1;i<=n;++i) cout<<ans[i]<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...