Submission #203561

# Submission time Handle Problem Language Result Execution time Memory
203561 2020-02-21T09:07:28 Z triplem5ds Carnival (CEOI14_carnival) C++14
20 / 100
97 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;
}
int32_t main(){
#ifdef ONLINE_JUDGE
  ios_base::sync_with_stdio(0); cin.tie(0);
#endif // ONLINE_JUDGE

  int n;
  cin >> n;
  vector<bool>vis(n+1);
  map<int,int> mp;
  int cur = 0;
  while(mp.size()!=n){
    vector<int> v;
    f(i,1,n+1)
      if(!vis[i]){
          if(v.empty())v.pb(i);
          else {
            v.pb(i);
            int x = ask(v);
            if(x!=1)v.pop_back();
          }
      }
    cur++;
    for(auto k:v){
      vis[k]=1;
      mp[k]=cur;
    }
  }

  cout<<0;
  f(i,1,n+1)  cout << ' ' << mp[i]; cout << endl;


  return 0;
}

Compilation message

carnival.cpp: In function 'int32_t main()':
carnival.cpp:30:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(mp.size()!=n){
         ~~~~~~~~~^~~
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:49:3: note: in expansion of macro 'f'
   f(i,1,n+1)  cout << ' ' << mp[i]; cout << endl;
   ^
carnival.cpp:49:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   f(i,1,n+1)  cout << ' ' << mp[i]; cout << endl;
                                     ^~~~
# Verdict Execution time Memory Grader output
1 Correct 13 ms 376 KB Output is correct
2 Correct 26 ms 376 KB Output is correct
3 Partially correct 47 ms 376 KB Partially correct
4 Partially correct 90 ms 248 KB Partially correct
5 Correct 7 ms 248 KB Output is correct
6 Correct 7 ms 248 KB Output is correct
7 Correct 21 ms 244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 376 KB Output is correct
2 Correct 24 ms 248 KB Output is correct
3 Partially correct 37 ms 376 KB Partially correct
4 Partially correct 84 ms 452 KB Partially correct
5 Correct 8 ms 248 KB Output is correct
6 Correct 9 ms 248 KB Output is correct
7 Correct 13 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 248 KB Output is correct
2 Correct 8 ms 316 KB Output is correct
3 Partially correct 33 ms 320 KB Partially correct
4 Partially correct 97 ms 504 KB Partially correct
5 Correct 12 ms 376 KB Output is correct
6 Correct 14 ms 252 KB Output is correct
7 Correct 28 ms 252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 376 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
3 Partially correct 79 ms 248 KB Partially correct
4 Partially correct 91 ms 324 KB Partially correct
5 Correct 17 ms 248 KB Output is correct
6 Correct 36 ms 376 KB Output is correct
7 Correct 30 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 18 ms 248 KB Output is correct
3 Partially correct 50 ms 376 KB Partially correct
4 Partially correct 56 ms 376 KB Partially correct
5 Correct 37 ms 248 KB Output is correct
6 Partially correct 61 ms 376 KB Partially correct
7 Partially correct 92 ms 248 KB Partially correct