제출 #66880

#제출 시각아이디문제언어결과실행 시간메모리
66880MKopchevUnscrambling a Messy Bug (IOI16_messy)C++14
49 / 100
4 ms640 KiB
#include<bits/stdc++.h> #include "messy.h" using namespace std; /* set<string> q; void add_element(string s) { cout<<"add "<<s<<endl; q.insert(s); } void compile_set() { } bool check_element(string s) { cout<<"ask "<<s<<endl; if(q.count(s))return 1; return 0; } */ bool check(string s) { bool ret=check_element(s); return ret; } vector<int> restore_permutation(int n, int w, int r) { srand(time(0)); string s={}; for(int i=0;i<n;i++)s=s+"1"; for(int i=0;i<n;i++) { s[i]='0'; add_element(s); } compile_set(); vector<int> result={}; for(int i=0;i<n;i++)result.push_back(-1); for(int i=0;i<n;i++) { string s=""; for(int j=0;j<n;j++)s=s+"1"; for(int j=0;j<n;j++) if(result[j]!=-1)s[j]='0'; vector<int> active={}; for(int j=0;j<n;j++) if(s[j]=='1')active.push_back(j); random_shuffle(active.begin(),active.end()); for(auto j:active) { s[j]='0'; r--; assert(r>=0); if(check(s)) { result[j]=i; break; } s[j]='1'; } } return result; } /* int main() { for(auto k:restore_permutation(4,16,16))cout<<k<<endl; } */

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:50:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
         for(int j=0;j<n;j++)
         ^~~
messy.cpp:52:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
             random_shuffle(active.begin(),active.end());
             ^~~~~~~~~~~~~~
#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...