Submission #702856

#TimeUsernameProblemLanguageResultExecution timeMemory
702856kxdCarnival (CEOI14_carnival)C++17
100 / 100
10 ms316 KiB
#include <bits/stdc++.h> #define int long long #define ll long long #define pb push_back #define p_q priority_queue #define m_p make_pair #define pii pair<int,int> #define endl '\n' #define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define FOR(i, a, b) for(int i = a; i <= b; i++) #define forn(i, n) for (int i = 0; i < n; i++) #define forn1(i, n) for (int i = 1; i <= n; i++) #define all(x) x.begin(),x.end() #define ft first #define sd second using namespace std; const int N = 1e5+5; const int INF = 1e18; const int MOD = 1e9+7; int c[N]; vector<int> v; bool bl[N]; signed main() { //INIT int n; cin >> n; v.pb(1); c[1] = 1; int t; for (int i = 2; i <= n; i++) { cout << v.size()+1 << ' '; for (auto x: v) { cout << x << ' '; } cout << i << endl; cin >> t; if (t > v.size()) { bl[i] = 1; v.pb(i); c[i] = v.size(); } } int ans = -1; for (int i = 2; i <= n; i++) { if (bl[i]) continue; int lo = 0, hi = v.size()-1; while (lo <= hi) { int mid = (lo+hi)/2; cout << mid+2 << ' '; for (int i = 0; i <= mid; i++) { cout << v[i] << ' '; } cout << i << endl; cin >> t; if (t == mid + 2) lo = mid + 1; else { ans = mid; hi = mid - 1; } } c[i] = c[v[ans]]; } cout << 0 << ' '; for (int i = 1; i <= n; i++) { cout << c[i] << ' '; } }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:40:15: 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]
   40 |         if (t > v.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...