Submission #710032

#TimeUsernameProblemLanguageResultExecution timeMemory
710032vjudge1Carnival (CEOI14_carnival)C++17
0 / 100
5 ms208 KiB
//#pragma GCC optimize ("O2") #include <bits/stdc++.h> #define ll long long #define int long long #define ld long double #define pll pair<ll,ll> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; const ll maxn = 200; vector<ll> T[200]; vector<ll> pos; ll A[maxn]; bool ask(ll l, ll r, ll k) { vector<ll> save; for(int i = l; i<= r; i++) save.push_back(pos[i]); save.push_back(k); cout << save.size() << " "; for(auto u: save) cout << u << " "; cout << "\n"; ll vl; cin >> vl; if(vl==save.size()) return 0; else return 1; } ll n; void fi(ll l, ll r, ll num) { if(l==r) { A[num] = l; return; } else { ll mid = ((l+r)>>1); if(ask(l, mid, num)) fi(l, mid, num); else fi(mid+1, r, num); } } void solve() { cin >> n; pos.push_back(1); A[1] = 0; for(int i = 2; i<= n; i++) { if(!ask(0, pos.size()-1, i)) { pos.push_back(i); A[i] = pos.size()-1; } else { fi(0, pos.size()-1, i); } } for(int i = 1; i<= n; i++) cout << A[i] << " "; } signed main() { //ios_base::sync_with_stdio(NULL) ; cin.tie(nullptr) ; cout.tie(nullptr); //freopen("case_06.txt","r",stdin); //freopen("BAJ.inp","r",stdin); //sfreopen("BAJ.out","w",stdout); //ll x; cin >> x; Debug(x); ll test_case = 1; //cin >> test_case; //sang(); for(int i = 1; i<=test_case; i++) { //cout << n << " " << m << "\n"; //if(n==0||m==0) return 0; solve(); } }

Compilation message (stderr)

carnival.cpp: In function 'bool ask(long long int, long long int, long long int)':
carnival.cpp:25:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     if(vl==save.size()) return 0;
      |        ~~^~~~~~~~~~~~~
#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...