답안 #750438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
750438 2023-05-29T14:00:36 Z vjudge1 사육제 (CEOI14_carnival) C++17
100 / 100
40 ms 328 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;
                }
            }
        }
    }
    cout << "0 ";
    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++){
      |                             ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 208 KB Output is correct
2 Correct 15 ms 208 KB Output is correct
3 Correct 15 ms 208 KB Output is correct
4 Correct 5 ms 328 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 12 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 208 KB Output is correct
2 Correct 19 ms 208 KB Output is correct
3 Correct 11 ms 208 KB Output is correct
4 Correct 9 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 40 ms 208 KB Output is correct
4 Correct 7 ms 324 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 11 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 10 ms 208 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 14 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 15 ms 208 KB Output is correct
3 Correct 23 ms 208 KB Output is correct
4 Correct 20 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 10 ms 324 KB Output is correct