Submission #414982

#TimeUsernameProblemLanguageResultExecution timeMemory
414982Ahmadsm2005Unscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
3 ms348 KiB
#include <bits/stdc++.h> #include "messy.h" //#include "grader.cpp" using namespace std; int P[150]; vector<int>restore_permutation(int n,int w,int r){ srand(2005); string s; vector<int>ANS; for(int i=0;i<n;i++) s+='0'; for(int i=0;i<n;i++){ s[i]='1'; add_element(s); } compile_set(); for(int i=0;i<n;i++) s[i]='0'; int FF=0; while(1){ int X=count(s.begin(),s.end(),'0'); if(!X) break; while(1){ int Q=rand()%X,POS; for(int i=0;i<n;i++){ if(s[i]=='0'&&!Q){ s[i]='1',POS=i; break; } else if(s[i]=='0') Q--; } string t; for(int i=0;i<n;i++) if(s[i]=='X') t+='0'; else t+=s[i]; if(X>1){ if(check_element(t)){ s=t; P[POS]=FF; break; } else s[POS]='X'; } else{ s=t; P[POS]=FF; break; } X--; } FF++; } for(int i=0;i<n;i++) ANS.push_back(P[i]); return ANS; }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:43:7: warning: 'POS' may be used uninitialized in this function [-Wmaybe-uninitialized]
   43 | P[POS]=FF;
      | ~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...