Submission #919884

# Submission time Handle Problem Language Result Execution time Memory
919884 2024-02-01T19:04:21 Z HaciyevAlik Carnival (CEOI14_carnival) C++14
0 / 100
2 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int ans[155];
int main(){
    //ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n,x=1; cin >> n;
    vector<int> v;
    ans[1]=1;
    v.push_back(1);
    for(int i=2;i<=n;++i) {
        int l=1,r=int(v.size()),best=0;
        while(l<=r) {
            int mid=(l+r)/2;
            cout << mid + 1 << ' ' << i << ' ';
            for(int j=0;j<mid;++j) {
                cout << v[j] << ' ';
            }
            cout << '\n';
            fflush(stdout);
            int cur; cin >> cur;
            if(cur==mid+1) {
                best=mid;
                l=mid+1;
            } else {
                r=mid-1;
            }
        }
        if(best==v.size()) {
            v.push_back(++x);
            ans[i]=x;
        } else {
            ans[i]=v[best];
        }
    }
    cout << "0 ";
    for(int i=1;i<=n;++i) {
        cout << ans[i] << ' ';
    }
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:29:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if(best==v.size()) {
      |            ~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 2 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -