제출 #121348

#제출 시각아이디문제언어결과실행 시간메모리
121348Charis02Unscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
4 ms384 KiB
#include <vector> #include <algorithm> #include "messy.h" #define rep(i,a,b) for(int i = a;i < b;i++) using namespace std; vector < int > result(230); void init(int low,int high,int n) { if(low == high) return; int mid = (low+high)/2; string s = ""; rep(i,0,n) s += "1"; rep(i,low,high+1) s[i] = '0'; rep(i,low,mid+1) { s[i] = '1'; add_element(s); s[i] = '0'; } init(low,mid,n); init(mid+1,high,n); return; } void solve(int low,int high,int n,vector < int > pos,string s) { if(low == high) { result[low] = pos[0]; return; } int mid = (low+high)/2; string aristera = s; string deksia = s; vector < int > posl; vector < int > posr; rep(i,0,n) { aristera[i] = deksia[i] = '1'; } rep(i,0,pos.size()) { aristera[pos[i]] = deksia[pos[i]] = '0'; } rep(i,0,pos.size()) { int x = pos[i]; s[x] = '1'; if(check_element(s)) { aristera[x] = '1'; posl.push_back(x); } else { deksia[x] = '1'; posr.push_back(x); } } solve(low,mid,n,posl,aristera); solve(mid+1,high,n,posr,deksia); return; } std::vector<int> restore_permutation(int n, int w, int r) { string s = ""; init(0,n-1,0); compile_set(); vector < int > v; rep(i,0,n) { v.push_back(i); s += "0"; } solve(0,n-1,n,v,s); }

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

messy.cpp: In function 'void solve(int, int, int, std::vector<int>, std::__cxx11::string)':
messy.cpp:4:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,a,b) for(int i = a;i < b;i++)
messy.cpp:59:9:
     rep(i,0,pos.size())
         ~~~~~~~~~~~~~~              
messy.cpp:59:5: note: in expansion of macro 'rep'
     rep(i,0,pos.size())
     ^~~
messy.cpp:4:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,a,b) for(int i = a;i < b;i++)
messy.cpp:64:9:
     rep(i,0,pos.size())
         ~~~~~~~~~~~~~~              
messy.cpp:64:5: note: in expansion of macro 'rep'
     rep(i,0,pos.size())
     ^~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:102:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#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...