Submission #244285

# Submission time Handle Problem Language Result Execution time Memory
244285 2020-07-03T13:57:48 Z kimbj0709 Carnival (CEOI14_carnival) C++14
100 / 100
15 ms 424 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define maxn 155
int32_t main() {
  int no_of_input;
  int input;
  cin >> no_of_input;
  vector<int> rep;
  vector<int> col(maxn,0);
  int currcnt = 1;
  for(int i=1;i<=no_of_input;i++){
    cout << rep.size()+1 << " ";
    for(auto k:rep){
      cout << k << " ";
    }
    cout << i << endl;
    cin >> input;
    if(input==rep.size()+1){
      col[i] = currcnt;
      currcnt++;
      rep.push_back(i); 
    }
  }
  for(int i=1;i<=no_of_input;i++){
    if(col[i]!=0){
      continue;
    }
    vector<int> temp = rep;
    while(temp.size()!=1){
      vector<int> front,back;
      for(int j=0;j<temp.size()/2;j++){
        front.push_back(temp[j]);
      }
      for(int j=temp.size()/2;j<temp.size();j++){
        back.push_back(temp[j]);
      }
      cout << front.size()+1 << " ";
      for(auto k:front){
        cout << k << " ";
      }
      cout << i << endl;
      cin >> input;
      if(input==front.size()){
        temp = front;
      }
      else{
        temp = back;
      }
    }
    col[i] = col[temp[0]];
  }
  cout << 0 << " ";
  for(int i=1;i<=no_of_input;i++){
    cout << col[i] << " ";
  }
  cout << endl;
}

Compilation message

carnival.cpp: In function 'int32_t main()':
carnival.cpp:19:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(input==rep.size()+1){
        ~~~~~^~~~~~~~~~~~~~
carnival.cpp:32:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int j=0;j<temp.size()/2;j++){
                   ~^~~~~~~~~~~~~~
carnival.cpp:35:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int j=temp.size()/2;j<temp.size();j++){
                               ~^~~~~~~~~~~~
carnival.cpp:44:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if(input==front.size()){
          ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 256 KB Output is correct
2 Correct 11 ms 384 KB Output is correct
3 Correct 12 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 9 ms 384 KB Output is correct
6 Correct 7 ms 256 KB Output is correct
7 Correct 11 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 384 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 10 ms 256 KB Output is correct
4 Correct 8 ms 256 KB Output is correct
5 Correct 13 ms 384 KB Output is correct
6 Correct 12 ms 256 KB Output is correct
7 Correct 11 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 12 ms 256 KB Output is correct
3 Correct 11 ms 384 KB Output is correct
4 Correct 8 ms 256 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 14 ms 384 KB Output is correct
7 Correct 15 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 384 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 10 ms 256 KB Output is correct
4 Correct 8 ms 256 KB Output is correct
5 Correct 13 ms 384 KB Output is correct
6 Correct 11 ms 256 KB Output is correct
7 Correct 12 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 11 ms 256 KB Output is correct
3 Correct 10 ms 256 KB Output is correct
4 Correct 12 ms 384 KB Output is correct
5 Correct 9 ms 376 KB Output is correct
6 Correct 8 ms 424 KB Output is correct
7 Correct 7 ms 384 KB Output is correct