제출 #500595

#제출 시각아이디문제언어결과실행 시간메모리
500595REALITYNB사육제 (CEOI14_carnival)C++17
100 / 100
19 ms304 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; int main() { int n; cin>>n; vector<vector<int>> a={{1}}; for(int i=2;i<=n;i++){ int l=-1,r=a.size(); while(r-l!=1){ int md=(r+l)/2; vector<int> ask={i}; for(int j=0;j<=md;j++) for(int x : a[j]) ask.push_back(x); cout << ask.size() << " " ; for(int y : ask) cout << y << " " ; cout << endl ; int answer ; cin>>answer; if(answer==md+1) r=md; else l=md; } vector<int> nw = {i}; if(r==a.size()) a.pb(nw); else a[r].pb(i); } cout << 0 << " " ; vector<int> answer(n+1); for(int i=0;i<a.size();i++) for(int x : a[i]) answer[x]=i+1; for(int i=1;i<=n;i++) cout << answer[i] << " " ; return 0; }

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

carnival.cpp: In function 'int main()':
carnival.cpp:29:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   if(r==a.size())
      |      ~^~~~~~~~~~
carnival.cpp:36:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |  for(int i=0;i<a.size();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...