제출 #385679

#제출 시각아이디문제언어결과실행 시간메모리
385679monus1042사육제 (CEOI14_carnival)C++17
0 / 100
2 ms364 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; #define pb push_back const int NAX = 200; int n; int main(){ cin>>n; map<int, vector<int> > g; int curr=1; g[1].pb(1); for (int i=2; i<=n; i++){ cout<<i<<' '; for (auto j=g.begin(); j!=g.end(); j++){ for (int k=0; k<j->second.size(); k++){ cout<<j->second[k]<<' '; } } cout<<endl; int ans; cin>>ans; if (ans>curr){ curr++; g[curr].pb(i); }else{ // it's equal vector<ii> aux; // index, color for (auto j=g.begin(); j!=g.end(); j++) aux.pb(ii(j->second[0], j->first)); int m=aux.size(); int lo=m-1, hi=-1; while(lo-1!=hi){ int mid=(lo+hi)/2; vector<int> show; for (int k=mid; k<m; k++){ show.pb(aux[k].first); } cout<<show.size() + 1<<' '; for (int k=0; k<show.size(); k++) cout<<show[k]<<' '; cout<<i; cout<<endl; int an; cin>>an; if (an==(int)show.size() + 1) lo=mid; else hi=mid; } int mid=lo; vector<int> show; for (int k=mid; k<m; k++){ show.pb(aux[k].first); } cout<<show.size() + 1<<' '; for (int k=0; k<show.size(); k++) cout<<show[k]<<' '; cout<<i; cout<<endl; int an; cin>>an; if (an==(int)show.size() + 1) lo--; g[aux[lo].second].pb(i); } } vector<int> ans(NAX); for (auto i=g.begin(); i!=g.end(); i++){ for (int j=0; j<i->second.size(); j++) ans[i->second[j]]=i->first; } cout<<0<<' '; for (int i=1; i<=n; i++) cout<<ans[i]<<' '; cout<<endl; return 0; }

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

carnival.cpp: In function 'int main()':
carnival.cpp:17:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |    for (int k=0; k<j->second.size(); k++){
      |                  ~^~~~~~~~~~~~~~~~~
carnival.cpp:38:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (int k=0; k<show.size(); k++) cout<<show[k]<<' ';
      |                   ~^~~~~~~~~~~~
carnival.cpp:51:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |    for (int k=0; k<show.size(); k++) cout<<show[k]<<' ';
      |                  ~^~~~~~~~~~~~
carnival.cpp:62:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |   for (int j=0; j<i->second.size(); j++) ans[i->second[j]]=i->first;
      |                 ~^~~~~~~~~~~~~~~~~
#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...