Submission #533242

# Submission time Handle Problem Language Result Execution time Memory
533242 2022-03-05T07:31:43 Z kebine Carnival (CEOI14_carnival) C++17
0 / 100
2 ms 200 KB
#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 << 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

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 time Memory Grader output
1 Execution timed out 2 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -