Submission #995908

#TimeUsernameProblemLanguageResultExecution timeMemory
995908fimhCarnival (CEOI14_carnival)C++14
100 / 100
5 ms600 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pll = pair<ll, ll>; #define fi first #define int long long #define se second const ll N = 150 + 5; const ll blocksz = 320; const ll mod = 1e9 + 7; const ll inf = 1e18; ll n, rep; ll id[N]; void task(){ cin >> n; vector<ll> v; for (int i = 1; i <= n; ++i){ cout << i << " "; for (int j = 1; j <= i; ++j) cout << j << " "; cout << endl; cin >> rep; // cout << v.size() << " "; if (rep == v.size()){ // cout << "ddd"; int l = -1, r = v.size() - 1; while (l < r){ ll m = l + (r - l + 1) / 2; // cout << m << " "; cout << v.size() - m + 1<< " " << i << " "; for (int j = m; j < v.size(); ++j) cout << v[j] << " "; cout << endl; cin >> rep; if (rep < v.size() - m + 1) l = m; else r = m - 1; } id[i] = id[v[l]]; }else{ v.push_back(i); id[i] = v.size(); } } cout << 0 << " "; for (int i = 1; i <= n; ++i){ cout << id[i] << " "; } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll TC = 1; // cin >> TC; while (TC--) task(); }

Compilation message (stderr)

carnival.cpp: In function 'void task()':
carnival.cpp:28:19: 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]
   28 |           if (rep == v.size()){
      |               ~~~~^~~~~~~~~~~
carnival.cpp:35:39: 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]
   35 |                     for (int j = m; j < v.size(); ++j) cout << v[j] << " ";
      |                                     ~~^~~~~~~~~~
carnival.cpp:38:29: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'long long unsigned int' [-Wsign-compare]
   38 |                     if (rep < v.size() - m + 1) l = m;
      |                         ~~~~^~~~~~~~~~~~~~~~~~
#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...