Submission #971231

#TimeUsernameProblemLanguageResultExecution timeMemory
971231makanhuliaCarnival (CEOI14_carnival)C++17
0 / 100
1 ms440 KiB
#include<bits/stdc++.h> #define pb push_back using namespace std; int main(){ int n; cin >> n; vector<int> sim; vector<int> belum; int warna[155]; for(int i = 1; i <= n; i++){ cout << sim.size() + 1; for(int j = 0; j < sim.size(); j++){ cout << " " << sim[j]; } cout << " " << i; cout << endl; int jawab; cin >> jawab; if(jawab == sim.size() + 1){ sim.pb(i); }else{ belum.pb(i); } } for(int i = 0; i < sim.size(); i++){ warna[sim[i]] = i + 1; } for(int i = 0; i < belum.size(); i++){ int now = belum[i]; int l = 0, r = sim.size(); int ans = -1; while(l <= r){ int mid = (l + r)/2; cout << now; for(int j = 0; j <= mid; j++){ cout << " " << sim[j]; } cout << endl; int idx = mid + 1; int jawab; cin >> jawab; if(jawab == idx){ ans = mid; r = mid - 1; }else{ l = mid + 1; } } warna[now] = 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:14:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int j = 0; j < sim.size(); j++){
      |                        ~~^~~~~~~~~~~~
carnival.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         if(jawab == sim.size() + 1){
      |            ~~~~~~^~~~~~~~~~~~~~~~~
carnival.cpp:28:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i = 0; i < sim.size(); i++){
      |                    ~~^~~~~~~~~~~~
carnival.cpp:32:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i = 0; i < belum.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...