Submission #996210

#TimeUsernameProblemLanguageResultExecution timeMemory
996210vjudge1Carnival (CEOI14_carnival)C++17
0 / 100
4 ms344 KiB
#include <bits/stdc++.h> using namespace std; long long i, j, l, r, mid, p, p2, q, k, t, n, m, a, b, c, d, cnt, ans[205]; vector <long long> arr; const long long mod = 9999919999; string s; bool check; long long query (vector <long long> a){ long long n = a.size(); cout << n << " "; for (long long i = 0; i < n; i += 1){ cout << a[i] << " "; } cout << endl; long long thl_bu_dau_sigma_top_1_doi_tuyen; cin >> thl_bu_dau_sigma_top_1_doi_tuyen; return thl_bu_dau_sigma_top_1_doi_tuyen; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; arr.push_back(1); for (i = 2; i <= n; i += 1){ vector <long long> res = arr; res.push_back(i); if (query(res) == res.size()){ arr.push_back(i); ans[i] = arr.size(); } else{ l = 0; r = arr.size() - 1; p = 0; while (l <= r){ mid = (l + r) >> 1; res.clear(); for (j = l; j <= mid; j += 1){ res.push_back(arr[j]); } res.push_back(i); if (query(res) == mid - l + 1){ p = arr[mid]; r = mid - 1; } else{ l = mid + 1; } } ans[i] = ans[p]; } } cout << 0 << " " << 1 << " "; for (i = 2; i <= n; i += 1){ cout << ans[i] << " "; } cout << endl; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:29:18: 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]
   29 |   if (query(res) == res.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...