제출 #261718

#제출 시각아이디문제언어결과실행 시간메모리
261718yabsed동굴 (IOI13_cave)C++17
0 / 100
1184 ms632 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int which_switch[N], how_switch[N], used[N], used_ans[N], used_for[N]; memset(which_switch, 0, sizeof(which_switch)); memset(how_switch, 0, sizeof(how_switch)); memset(used, 0, sizeof(used)); memset(used_ans, 0, sizeof(used_ans)); memset(used_for, 0, sizeof(used_for)); for(int i=0;i<N;i++){ vector <int> p, np; int v[N]; memset(v, 0, sizeof(v)); for(int j=0;j<N;j++){ if(!used[j])p.push_back(j); else np.push_back(j); } int l=0, r=p.size()-1, mid; for(int j=0;j<np.size();j++)v[np[j]]=used_ans[np[j]]; for(int j=0;j<p.size();j++)v[p[j]]=0; int res=tryCombination(v); if(res==i)how_switch[i]=1; else how_switch[i]=0; while(l<r){ mid=(l+r)/2; for(int j=0;j<np.size();j++)v[np[j]]=used_ans[np[j]]; for(int j=0;j<=mid;j++)v[p[j]]=how_switch[i]; for(int j=mid+1;j<p.size();j++)v[p[j]]=1-how_switch[i]; int res=tryCombination(v); if(res==i)l=mid+1; else r=mid; } which_switch[i]=l; used_ans[l]=how_switch[i]; used_for[l]=i; } answer(used_for, used_ans); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:22:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<np.size();j++)v[np[j]]=used_ans[np[j]];
                     ~^~~~~~~~~~
cave.cpp:23:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<p.size();j++)v[p[j]]=0;
                     ~^~~~~~~~~
cave.cpp:30:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j=0;j<np.size();j++)v[np[j]]=used_ans[np[j]];
                         ~^~~~~~~~~~
cave.cpp:32:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j=mid+1;j<p.size();j++)v[p[j]]=1-how_switch[i];
                             ~^~~~~~~~~
#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...