답안 #168771

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168771 2019-12-16T07:22:55 Z GioChkhaidze 사육제 (CEOI14_carnival) C++14
100 / 100
11 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

int n,C[156],x,tot;
vector < int > v;

void Go(int y,int l,int r) {
  if (l==r) {
    C[y]=C[v[l]];
    return ;
  }

  int mid=(l+r)/2;

  cout<<mid-l+2<<" ";
  for (int i=l; i<=mid; i++) cout<<v[i]<<" ";
  cout<<y<<endl;

  cin>>x;

  if (x==mid-l+2-1) Go(y,l,mid);
      else Go(y,mid+1,r);
}

main () {
  cin>>n;

  for (int i=1; i<=n; i++) {
    v.push_back(i);

    cout<<v.size()<<" ";
    for (int j=0; j<v.size(); j++) cout<<v[j]<<" ";
    cout<<endl;
    cin>>x;

    if (x==v.size()) {
      C[v.back()]=++tot;
      continue;
    }

    int y=v.back();
    v.pop_back();
    Go(y,0,v.size());
  }

  cout<<0<<" ";
  for (int i=1; i<=n; i++)
    cout<<C[i]<<" ";
    cout<<endl;
  return 0;
}

Compilation message

carnival.cpp:25:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
carnival.cpp: In function 'int main()':
carnival.cpp:32:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int j=0; j<v.size(); j++) cout<<v[j]<<" ";
                   ~^~~~~~~~~
carnival.cpp:36:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (x==v.size()) {
         ~^~~~~~~~~~
carnival.cpp:47:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for (int i=1; i<=n; i++)
   ^~~
carnival.cpp:49:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     cout<<endl;
     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 248 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Correct 6 ms 248 KB Output is correct
4 Correct 4 ms 316 KB Output is correct
5 Correct 4 ms 248 KB Output is correct
6 Correct 4 ms 248 KB Output is correct
7 Correct 9 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 248 KB Output is correct
2 Correct 9 ms 248 KB Output is correct
3 Correct 6 ms 248 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 5 ms 248 KB Output is correct
7 Correct 9 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Correct 10 ms 376 KB Output is correct
4 Correct 4 ms 320 KB Output is correct
5 Correct 7 ms 248 KB Output is correct
6 Correct 9 ms 248 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 248 KB Output is correct
3 Correct 4 ms 248 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 5 ms 248 KB Output is correct
7 Correct 11 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 248 KB Output is correct
2 Correct 10 ms 248 KB Output is correct
3 Correct 9 ms 292 KB Output is correct
4 Correct 8 ms 248 KB Output is correct
5 Correct 5 ms 504 KB Output is correct
6 Correct 5 ms 248 KB Output is correct
7 Correct 6 ms 248 KB Output is correct