제출 #713048

#제출 시각아이디문제언어결과실행 시간메모리
713048lam동굴 (IOI13_cave)C++14
0 / 100
753 ms680 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; int n; int dau[5010],s[5010],d[5010]; vector <int> tmp; //int tryCombination(int a[]) //{ // for (int i=0; i<n; i++) cout<<a[i]<<' '; cout<<endl; // int x; cin>>x; // return x; //} //void answer(int s[], int d[]) //{ // cout<<"answer"<<endl; // for (int i=0; i<n; i++) cout<<s[i]<<' '<<endl; // for (int i=0; i<n; i++) cout<<d[i]<<' '<<endl; // //} void exploreCave(int N) { /* ... */ n=N; tmp.clear(); for (int i=0; i<n; i++) dau[i]=0; for (int i=0; i<n; i++) tmp.push_back(i); for (int it=0; it<n; it++) { int temp = tryCombination(dau); if (temp > it || temp==-1) { for (int i:tmp) dau[i] ^= 1; temp = tryCombination(dau); } int l = 0; int r=tmp.size()-1; int ans = -1; while (l<=r) { int mid=(l+r)/2; for (int i=0; i<=mid; i++) dau[tmp[i]]^=1; int val = tryCombination(dau); for (int i=0; i<=mid; i++) dau[tmp[i]]^=1; if (val>it||val==-1) { ans=mid; r=mid-1; } else l=mid+1; } d[ans] = it; dau[ans] ^= 1; for (int i=ans+1; i<tmp.size(); i++) swap(tmp[i],tmp[i-1]); tmp.pop_back(); // cout<<it<<" := "; for (int i:tmp) cout<<i<<' '; cout<<endl; } answer(dau,d); } //signed main() //{ // int x; cin>>x; // exploreCave(x); //}

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:51:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |         for (int i=ans+1; i<tmp.size(); i++) swap(tmp[i],tmp[i-1]);
      |                           ~^~~~~~~~~~~
#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...