제출 #59804

#제출 시각아이디문제언어결과실행 시간메모리
59804alenam0161Unscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
3 ms384 KiB
#include <vector> #include "messy.h" #include <bits/stdc++.h> using namespace std; const int N = 4007; int wh[N]; bool used[N]; std::vector<int> restore_permutation(int n, int w, int r) { srand(15721); string s=string(n,'0'); for(int i=1;i<n;++i){ string s1=string(i,'1'); s1+=string(n-i,'0'); add_element(s1); } int hw=0; compile_set(); for(int i=0;i<n-1;++i){ string sx=s; vector<int> l; for(int j=0;j<n;++j){ if(used[j]==0){ l.push_back(j); } } random_shuffle(l.begin(),l.end()); for(int j=0;j<l.size();++j){ string nw=s; nw[l[j]]='1'; hw++; if(check_element(nw)==true){ s[l[j]]='1'; wh[l[j]]=i; used[l[j]]=true; break; } } } for(int j=0;j<n;++j){ if(used[j]==0)wh[j]=n-1; } vector<int> ans; for(int i=0;i<n;++i){ ans.push_back(wh[i]); } // cout<<"i am"<<hw<<" en am"<<endl; return ans; }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:27:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<l.size();++j){
                     ~^~~~~~~~~
#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...