Submission #752661

#TimeUsernameProblemLanguageResultExecution timeMemory
752661beaconmcCarnival (CEOI14_carnival)C++14
100 / 100
10 ms448 KiB
#include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for (ll i = (x); i < (y); i++) using namespace std; // cd "/home/s/saco06/Desktop/" && g++ carnival.cpp -o carnival && "/home/s/saco06/Desktop/"carnival ll query(vector<ll> q){ cout << q.size() << " "; for (auto&i : q){ cout << i << " "; } ll resp; cin >> resp; return resp; } int main(){ ll n; cin >> n; vector<vector<ll>> stuff; ll cur = 0; vector<ll> buff; vector<ll> unused; FOR(i,0,n){ buff.push_back(i+1); ll resp = query(buff); if (resp != cur){ cur = resp; stuff.push_back({i+1}); }else{ unused.push_back(i+1); } } for (auto&num : unused){ ll lo = 0; ll hi = stuff.size(); while (lo < hi){ vector<ll> buff; ll mid = (lo+hi+1)/2; FOR(i,lo,mid){ buff.push_back(stuff[i][0]); } buff.push_back(num); ll resp = query(buff); if (resp == buff.size()) lo = mid; else hi = mid-1; } stuff[lo].push_back(num); } map<ll, ll> mapp; FOR(i,0, stuff.size()){ for (auto&j : stuff[i]){ mapp[j] = i; } } cout << 0 << " "; FOR(i,1,n+1){ cout << mapp[i]+1 << " "; } }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:52:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |             if (resp == buff.size()) lo = mid;
      |                 ~~~~~^~~~~~~~~~~~~~
carnival.cpp:4:39: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define FOR(i,x,y) for (ll i = (x); i < (y); i++)
      |                                       ^
carnival.cpp:58:5: note: in expansion of macro 'FOR'
   58 |     FOR(i,0, stuff.size()){
      |     ^~~
#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...