제출 #414974

#제출 시각아이디문제언어결과실행 시간메모리
414974Ahmadsm2005Unscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
4 ms332 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(check_element(t)){ s=t; P[POS]=FF; break; } else s[POS]='X'; X--; } FF++; } for(int i=0;i<n;i++) ANS.push_back(P[i]); return ANS; }

컴파일 시 표준 에러 (stderr) 메시지

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:42:7: warning: 'POS' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 | 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...