Submission #533259

# Submission time Handle Problem Language Result Execution time Memory
533259 2022-03-05T08:07:59 Z devariaota Carnival (CEOI14_carnival) C++17
100 / 100
17 ms 296 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 + 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

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 Correct 6 ms 200 KB Output is correct
2 Correct 10 ms 200 KB Output is correct
3 Correct 4 ms 200 KB Output is correct
4 Correct 5 ms 200 KB Output is correct
5 Correct 2 ms 288 KB Output is correct
6 Correct 2 ms 288 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 200 KB Output is correct
2 Correct 4 ms 200 KB Output is correct
3 Correct 7 ms 200 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
5 Correct 9 ms 200 KB Output is correct
6 Correct 9 ms 292 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 292 KB Output is correct
2 Correct 5 ms 296 KB Output is correct
3 Correct 17 ms 200 KB Output is correct
4 Correct 3 ms 288 KB Output is correct
5 Correct 9 ms 200 KB Output is correct
6 Correct 8 ms 200 KB Output is correct
7 Correct 9 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 292 KB Output is correct
2 Correct 3 ms 288 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
5 Correct 9 ms 200 KB Output is correct
6 Correct 4 ms 288 KB Output is correct
7 Correct 6 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 288 KB Output is correct
2 Correct 9 ms 296 KB Output is correct
3 Correct 7 ms 200 KB Output is correct
4 Correct 7 ms 200 KB Output is correct
5 Correct 4 ms 292 KB Output is correct
6 Correct 3 ms 200 KB Output is correct
7 Correct 7 ms 200 KB Output is correct