Submission #978168

# Submission time Handle Problem Language Result Execution time Memory
978168 2024-05-09T01:33:32 Z AlphaMale06 Carnival (CEOI14_carnival) C++14
0 / 100
4 ms 344 KB
#include <bits/stdc++.h>

using namespace std;

#define pb push_back

int main()
{
    int n;
    cin >> n;
    vector<int> qry;
    qry.pb(1);
    int c[n+1];
    c[1]=1;
    for(int i=2; i<=n; i++){
        qry.pb(i);
        cout << qry.size();
        for(int e : qry)cout << " " << e;
        cout << endl;
        int ans;
        cin >> ans;
        if(ans==qry.size()){
            c[i]=qry.size();
        }
        else{
            qry.pop_back();
            int l=0, r = qry.size()-1;
            while(l<r){
                int s = l+r>>1;
                cout << s-l+1;
                for(int i=l; i<s; i++)cout << " " << qry[i];
                cout << " " << i << endl;
                int anss;
                cin >> anss;
                if(anss==s-l+1)r=s;
                else l=s+1;
            }
            c[i]=c[qry[l]];
        }
    }
    cout << 0;
    for(int i=1; i<=n; i++)cout << " " << c[i];
    cout << endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:22:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if(ans==qry.size()){
      |            ~~~^~~~~~~~~~~~
carnival.cpp:29:26: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   29 |                 int s = l+r>>1;
      |                         ~^~
# 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 4 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 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -