Submission #644338

#TimeUsernameProblemLanguageResultExecution timeMemory
644338KriptonZalmoxis (BOI18_zalmoxis)C++14
30 / 100
131 ms12424 KiB
#include <bits/stdc++.h> using namespace std; int steve[1000001],vf; int v[1000001],v1[1000001]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,k,i,x; cin>>n>>k; for(i=1;i<=n;i++) { cin>>v[i]; v1[i]=v[i]; while(v[i]==v[steve[vf]]) { v[i]++; vf--; } steve[++vf]=i; } int ind,min1=40; for(i=1;i<=vf;i++) if(v[steve[i]]<min1) { min1=v[steve[i]]; ind=steve[i]; } for(i=1;i<=n;i++) { cout<<v1[i]<<" "; if(i==ind) cout<<min1<<" "; } return 0; }

Compilation message (stderr)

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:10:15: warning: unused variable 'x' [-Wunused-variable]
   10 |     int n,k,i,x;
      |               ^
zalmoxis.cpp:33:9: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |         if(i==ind)
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...