Submission #533259

#TimeUsernameProblemLanguageResultExecution timeMemory
533259devariaotaCarnival (CEOI14_carnival)C++17
100 / 100
17 ms296 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e9 + 7; #pragma GCC optimize("Ofast") #define vi vector<int> #define vll vector<ll> #define pii pair<int, int> #define mp make_pair #define pb push_back #define lb lower_bound #define ub upper_bound #define fi first #define sc second #define gl ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int main() { int n; cin >> n; vi baru, uda; for(int i = 1; i <= n; i++){ cout << baru.size() + 1; for(int j = 0; j < baru.size(); j++) cout << " " << baru[j]; cout << " " << i; cout << endl; int jawab; cin >> jawab; if(jawab == baru.size() + 1) baru.pb(i); else uda.pb(i); } int warna[155]; for(int i = 0; i < baru.size(); i++) warna[baru[i]] = i + 1; for(int i = 0; i < uda.size(); i++){ int cur = uda[i]; int l = 0, r = baru.size(); int ans = -1; while(l <= r){ int m = (l + r)/2; cout << m + 2 << " " << cur; for(int j = 0; j <= m; j++) cout << " " << baru[j]; cout << endl; int jawab; cin >> jawab; if(jawab == m + 1){ ans = m; r = m - 1; } else l = m + 1; } warna[cur] = ans + 1; } cout << 0; for(int i = 1; i <= n; i++) cout << " " << warna[i]; cout << endl; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int j = 0; j < baru.size(); j++)
      |                    ~~^~~~~~~~~~~~~
carnival.cpp:33:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     if(jawab == baru.size() + 1)
      |        ~~~~~~^~~~~~~~~~~~~~~~~~
carnival.cpp:40:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |   for(int i = 0; i < baru.size(); i++)
      |                  ~~^~~~~~~~~~~~~
carnival.cpp:43:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |   for(int i = 0; i < uda.size(); i++){
      |                  ~~^~~~~~~~~~~~
#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...