Submission #750436

# Submission time Handle Problem Language Result Execution time Memory
750436 2023-05-29T13:59:54 Z vjudge1 Carnival (CEOI14_carnival) C++17
0 / 100
8 ms 208 KB
#include<bits/stdc++.h>
using namespace std;
int n, a[10005];
bool vst[10005];
vector<int> last;
int ask(int i){
    cout << '?' << " " << i << endl;
    int pos;
    cin >> pos;
    return pos;
}
int main(){
    cin.tie(0)->sync_with_stdio(0);
    cin >> n;
    int cnt = 1;
    a[1] = 1;
    last.push_back(1);
    for(int i = 2 ; i <= n ; i++){
        cout << i << " " << 1;
        for(int j = 2 ; j <= i ; j++){
            cout << " " << j; 
        }
        cout << endl;
        int num;
        cin >> num;
        a[i] = num;
        if(num > cnt){
            cnt++;
            last.push_back(i);
        }
        else{
            for(int j = 0 ; j < last.size() ; j++){
                int v = last[j];
                cout << "2 " << v << " " << i << endl;
                cin >> num;
                if(num == 1){
                    last[j] = i;
                    a[i] = j + 1;
                    break;
                }
            }
        }
    }
    for(int i = 1 ; i <= n ; i++)
        cout << a[i] << " ";
    cout << endl;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:32:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             for(int j = 0 ; j < last.size() ; j++){
      |                             ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 208 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 208 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 208 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 208 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -