답안 #916351

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
916351 2024-01-25T17:42:24 Z Vladth11 사육제 (CEOI14_carnival) C++14
100 / 100
5 ms 600 KB
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
#pragma GCC optimize("Ofast")

using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;

const ll NMAX = 151;
const ll INF = (1LL << 60);
const ll nrbits = 20;
const ll MOD = 998244353;
const ll bucket = 320;
const double eps = 0.00000001;

int v[NMAX];
int top[NMAX];
vector <int> noi;

bool OK(int r, int i){
    cout << r + 2 << " ";
    for(int i = 0; i <= r; i++){
        cout << noi[i] << " ";
    }
    cout << i << endl;
    int rez;
    cin >> rez;
    if(rez == r + 2){
        return 1;
    }
    return 0;
}

signed main() {
#ifdef HOME
   // ifstream cin(".in");
   // ofstream cout(".out");
#endif // HOME
    int n, i;
    cin >> n;
    for(i = 1; i <= n; i++){
        cout << noi.size() + 1 << " ";
        for(auto x : noi){
            cout << x << " ";
        }
        cout << i << endl;
        int rez = 0;
        cin >> rez;
        if(rez == ((int)noi.size() + 1)){
            noi.push_back(i);
            top[i] = noi.size();
        }
    }
    for(i = 1; i <= n; i++){
        if(top[i]) continue;
        int r = -1, pas = (1 << 7);
        while(pas){
            if(r + pas < noi.size() && OK(r + pas, i)){
                r += pas;
            }
            pas /= 2;
        }
        r++;
        top[i] = top[noi[r]];
    }
    cout << 0 << " ";
    for(i = 1; i <= n; i++){
        cout << top[i] << " ";
    }
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:59:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |             if(r + pas < noi.size() && OK(r + pas, i)){
      |                ~~~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 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 2 ms 436 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 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 2 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 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 2 ms 436 KB Output is correct
5 Correct 3 ms 600 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 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 2 ms 436 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 2 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 428 KB Output is correct
7 Correct 3 ms 436 KB Output is correct