Submission #533256

# Submission time Handle Problem Language Result Execution time Memory
533256 2022-03-05T08:06:09 Z makanhulia Carnival (CEOI14_carnival) C++17
0 / 100
6 ms 292 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 << m + 1;
      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 Incorrect 6 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 292 KB Output is correct
2 Incorrect 6 ms 200 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -