제출 #139836

#제출 시각아이디문제언어결과실행 시간메모리
139836farhad13Unscrambling a Messy Bug (IOI16_messy)C++14
18 / 100
3 ms376 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; vector<int> restore_permutation(int n, int w, int r) { vector<int> vec; vec.assign(n,-1); map<string,int> m; string x(n,'0'); string y(n,'0'); for(int i=0;i<n-1;i++) {y[i]='1'; add_element(y); m[y]=1; } compile_set(); int cnt[100]; for(int i=0;i<n;i++)cnt[i]=1; for(int j=0;j<n;j++){ for(int i=0;i<n;i++) { if(x[i]=='1')continue; x[i]='1'; bool p=check_element(x); x[i]='0'; if(!m[x] && p)vec[j]=i; } if(vec[j]!=-1)x[vec[j]]='1',cnt[vec[j]]=0; } int h,d=0; for(int i=0;i<n;i++)if(cnt[i])h=i; for(int i=0;i<n;i++)if(vec[i]==-1)vec[i]=h,d++; if(d>1) for(int i=0;i<n;i++) vec[i]=i; vector<int> ans(n); for(int i=0;i<n;i++) {ans[vec[i]]=i;} //for(int i=0;i<n;i++)cout<<ans[i]<<" "; return ans; }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:33:41: warning: 'h' may be used uninitialized in this function [-Wmaybe-uninitialized]
 for(int i=0;i<n;i++)if(vec[i]==-1)vec[i]=h,d++;
#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...