제출 #778597

#제출 시각아이디문제언어결과실행 시간메모리
778597Sandarach151사육제 (CEOI14_carnival)C++17
20 / 100
64 ms416 KiB
#include<bits/stdc++.h> using namespace std; vector<vector<int>> func(vector<int> vect){ if(vect.size()==1){ vector<vector<int>> ans; vector<int> temp; temp.push_back(vect[0]); ans.push_back(temp); return ans; } else{ cout << vect.size(); for(int i=0; i<vect.size(); i++){ cout << ' ' << vect[i]; } cout << endl; int a; cin >> a; if(a==vect.size()){ vector<vector<int>> ans; for(int i=0; i<vect.size(); i++){ int b = vect[i]; vector<int> temp4; temp4.push_back(b); ans.push_back(temp4); } return ans; } else{ int mid = vect.size()/2; vector<int> vect1; vector<int> vect2; for(int i=0; i<mid; i++){ vect1.push_back(vect[i]); } for(int i=mid; i<vect.size(); i++){ vect2.push_back(vect[i]); } vector<vector<int>> temp1 = func(vect1); vector<vector<int>> temp2 = func(vect2); for(int i=0; i<temp1.size(); i++){ for(int j=0; j<temp2.size(); j++){ if(temp2[j][0]!=-1){ cout << 2 << ' ' << temp1[i][0] << ' ' << temp2[j][0] << endl; int a; cin >> a; if(a==1){ for(int k=0; k<temp2[j].size(); k++){ temp1[i].push_back(temp2[j][k]); } temp2[j][0]=-1; } } } } for(int i=0; i<temp2.size(); i++){ if(temp2[i][0]!=-1){ temp1.push_back(temp2[i]); } } return temp1; } } } int main(){ int n; cin >> n; vector<vector<int>> ans; vector<int> people; for(int i=1; i<=n; i++){ people.push_back(i); } ans = func(people); vector<int> finans(n+1); for(int i=0; i<ans.size(); i++){ for(int j=0; j<ans[i].size(); j++){ finans[ans[i][j]]=i+1; } } cout << 0; for(int i=1; i<=n; i++){ cout << ' ' << finans[i]; } return 0; }

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

carnival.cpp: In function 'std::vector<std::vector<int> > func(std::vector<int>)':
carnival.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int i=0; i<vect.size(); i++){
      |                      ~^~~~~~~~~~~~
carnival.cpp:20:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         if(a==vect.size()){
      |            ~^~~~~~~~~~~~~
carnival.cpp:22:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             for(int i=0; i<vect.size(); i++){
      |                          ~^~~~~~~~~~~~
carnival.cpp:37:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             for(int i=mid; i<vect.size(); i++){
      |                            ~^~~~~~~~~~~~
carnival.cpp:42:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             for(int i=0; i<temp1.size(); i++){
      |                          ~^~~~~~~~~~~~~
carnival.cpp:43:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |                 for(int j=0; j<temp2.size(); j++){
      |                              ~^~~~~~~~~~~~~
carnival.cpp:49:43: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |                             for(int k=0; k<temp2[j].size(); k++){
      |                                          ~^~~~~~~~~~~~~~~~
carnival.cpp:57:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |             for(int i=0; i<temp2.size(); i++){
      |                          ~^~~~~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:77:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |     for(int i=0; i<ans.size(); i++){
      |                  ~^~~~~~~~~~~
carnival.cpp:78:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |         for(int j=0; j<ans[i].size(); j++){
      |                      ~^~~~~~~~~~~~~~
#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...