답안 #203571

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
203571 2020-02-21T11:13:04 Z triplem5ds 사육제 (CEOI14_carnival) C++14
100 / 100
13 ms 504 KB
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include "bits/stdc++.h"
using namespace std;

#define f(i,a,b)  for(int i = a; i < b; i++)
#define pb push_back
#define F first
#define S second

const int N = 1e6+5;
const int MOD = 1e9 + 7;
int ask(vector<int> v){
  cout<<v.size();
  for(auto x:v)cout<<' '<<x;
  cout<<endl;
  int ret;  cin >> ret; return ret;
}
int col[155];
int get(vector<int> v, int x){
  int lo = 0, hi = v.size()-1;
  while(lo<hi){
    int md = lo + (hi - lo + 1) / 2;
    vector<int> tmp({x});
    f(j,0,md)tmp.pb(v[j]);
    if(ask(tmp)==tmp.size())
      lo = md;
    else
      hi = md - 1;
  }
  return col[v[lo]];
}
int32_t main(){
#ifdef ONLINE_JUDGE
  ios_base::sync_with_stdio(0); cin.tie(0);
#endif // ONLINE_JUDGE

  int n;  cin>>n;
  vector<int>v({1});
  col[1]=1;
  int cur = 1;
  f(i,2,n+1){
    v.pb(i);
    int x = ask(v);
    if(x!=v.size()){
      v.pop_back();
      col[i] = get(v,i);
    } else
      col[i] = ++cur;
  }
  cout << 0;
  f(i,1,n+1)cout << ' ' << col[i]; cout << endl;

  return 0;
}

Compilation message

carnival.cpp: In function 'int get(std::vector<int>, int)':
carnival.cpp:27:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(ask(tmp)==tmp.size())
        ~~~~~~~~^~~~~~~~~~~~
carnival.cpp: In function 'int32_t main()':
carnival.cpp:46:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(x!=v.size()){
        ~^~~~~~~~~~
carnival.cpp:7:19: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
 #define f(i,a,b)  for(int i = a; i < b; i++)
                   ^
carnival.cpp:53:3: note: in expansion of macro 'f'
   f(i,1,n+1)cout << ' ' << col[i]; cout << endl;
   ^
carnival.cpp:53:36: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   f(i,1,n+1)cout << ' ' << col[i]; cout << endl;
                                    ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 376 KB Output is correct
2 Correct 9 ms 320 KB Output is correct
3 Correct 10 ms 376 KB Output is correct
4 Correct 8 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 11 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 248 KB Output is correct
2 Correct 13 ms 376 KB Output is correct
3 Correct 8 ms 248 KB Output is correct
4 Correct 9 ms 248 KB Output is correct
5 Correct 9 ms 252 KB Output is correct
6 Correct 9 ms 376 KB Output is correct
7 Correct 13 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 11 ms 248 KB Output is correct
3 Correct 13 ms 376 KB Output is correct
4 Correct 8 ms 504 KB Output is correct
5 Correct 7 ms 248 KB Output is correct
6 Correct 10 ms 376 KB Output is correct
7 Correct 13 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 9 ms 248 KB Output is correct
3 Correct 11 ms 248 KB Output is correct
4 Correct 8 ms 376 KB Output is correct
5 Correct 10 ms 376 KB Output is correct
6 Correct 8 ms 404 KB Output is correct
7 Correct 13 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 248 KB Output is correct
2 Correct 12 ms 248 KB Output is correct
3 Correct 12 ms 248 KB Output is correct
4 Correct 10 ms 248 KB Output is correct
5 Correct 10 ms 376 KB Output is correct
6 Correct 7 ms 320 KB Output is correct
7 Correct 9 ms 316 KB Output is correct