Submission #916351

#TimeUsernameProblemLanguageResultExecution timeMemory
916351Vladth11Carnival (CEOI14_carnival)C++14
100 / 100
5 ms600 KiB
#include <bits/stdc++.h> #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " #pragma GCC optimize("Ofast") using namespace std; typedef long long ll; typedef pair <ll, ll> pii; const ll NMAX = 151; const ll INF = (1LL << 60); const ll nrbits = 20; const ll MOD = 998244353; const ll bucket = 320; const double eps = 0.00000001; int v[NMAX]; int top[NMAX]; vector <int> noi; bool OK(int r, int i){ cout << r + 2 << " "; for(int i = 0; i <= r; i++){ cout << noi[i] << " "; } cout << i << endl; int rez; cin >> rez; if(rez == r + 2){ return 1; } return 0; } signed main() { #ifdef HOME // ifstream cin(".in"); // ofstream cout(".out"); #endif // HOME int n, i; cin >> n; for(i = 1; i <= n; i++){ cout << noi.size() + 1 << " "; for(auto x : noi){ cout << x << " "; } cout << i << endl; int rez = 0; cin >> rez; if(rez == ((int)noi.size() + 1)){ noi.push_back(i); top[i] = noi.size(); } } for(i = 1; i <= n; i++){ if(top[i]) continue; int r = -1, pas = (1 << 7); while(pas){ if(r + pas < noi.size() && OK(r + pas, i)){ r += pas; } pas /= 2; } r++; top[i] = top[noi[r]]; } cout << 0 << " "; for(i = 1; i <= n; i++){ cout << top[i] << " "; } return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:59:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |             if(r + pas < noi.size() && OK(r + pas, i)){
      |                ~~~~~~~~^~~~~~~~~~~~
#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...