답안 #995908

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995908 2024-06-10T03:47:55 Z fimh 사육제 (CEOI14_carnival) C++14
100 / 100
5 ms 600 KB
#include <bits/stdc++.h>
using namespace std; 

using ll = long long;
using pll = pair<ll, ll>;

#define fi first
#define int long long
#define se second

const ll N = 150 + 5;
const ll blocksz = 320;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll n, rep;
ll id[N];

void task(){
     cin >> n;
     vector<ll> v;
     for (int i = 1; i <= n; ++i){
          cout << i << " ";
          for (int j = 1; j <= i; ++j) cout << j << " ";
          cout << endl;
          cin >> rep;
          // cout << v.size() << " ";
          if (rep == v.size()){
               // cout << "ddd";
               int l = -1, r = v.size() - 1;
               while (l < r){
                    ll m = l + (r - l + 1) / 2;
                    // cout << m << " ";
                    cout << v.size() - m + 1<< " " << i << " ";
                    for (int j = m; j < v.size(); ++j) cout << v[j] << " ";
                    cout << endl;
                    cin >> rep;
                    if (rep < v.size() - m + 1) l = m;
                    else r = m - 1;
               }
               id[i] = id[v[l]];
          }else{
               v.push_back(i);
               id[i] = v.size(); 
          }
     }
     cout << 0 << " ";
     for (int i = 1; i <= n; ++i){
          cout << id[i] << " ";
     }
}         
     
signed main(){
     ios_base::sync_with_stdio(0); 
     cin.tie(0); cout.tie(0);
     ll TC = 1; // cin >> TC;
     while (TC--) task();
}

Compilation message

carnival.cpp: In function 'void task()':
carnival.cpp:28:19: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |           if (rep == v.size()){
      |               ~~~~^~~~~~~~~~~
carnival.cpp:35:39: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |                     for (int j = m; j < v.size(); ++j) cout << v[j] << " ";
      |                                     ~~^~~~~~~~~~
carnival.cpp:38:29: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'long long unsigned int' [-Wsign-compare]
   38 |                     if (rep < v.size() - m + 1) l = m;
      |                         ~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 3 ms 600 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 2 ms 344 KB Output is correct