Submission #531809

# Submission time Handle Problem Language Result Execution time Memory
531809 2022-03-01T14:53:04 Z makanhulia Carnival (CEOI14_carnival) C++17
20 / 100
104 ms 288 KB
#include <bits/stdc++.h>

using namespace std;

int ask(int x, int y){
    int in;
    cout << "2 " << x << " " << y << endl;
    cin >> in;

    return in;
}

int main(){
    int n; cin >> n;
    cout << n << " ";
    for(int i = 1; i <= n; i++) cout << i << " ";
    cout << endl;

    int costumes; cin >> costumes;
    int lc = 1;
    int c[n + 1], p[costumes + 1];
    memset(p, -1, sizeof(p));
    memset(c, -1, sizeof(c));
    c[1] = 1;
    p[1] = 1;

    for(int i = 2; i <= n; i++){
        int tmp = ask(i - 1, i);
        if(tmp == 1) c[i] = c[i - 1];

        else{
            for(int j = 1; j <= costumes; j++){
                if(p[j] == -1 || p[j] == i - 1) continue;
                tmp = ask(i, p[j]);

                if(tmp == 1){
                    c[i] = j;
                    break;
                }
            }   

            if(c[i] == -1){
                lc++;
                c[i] = lc;
                p[lc] = i;
            }
        }
    }

    cout << "0 ";
    for(int i = 1; i <= n; i++) cout << c[i] << " ";
    cout << endl;

    return 0;
}

// 2 1 2 3 1
//first we need to know how many different costumes exist
//bfta - brute force the answer
//yus
# Verdict Execution time Memory Grader output
1 Correct 10 ms 200 KB Output is correct
2 Correct 24 ms 200 KB Output is correct
3 Partially correct 52 ms 200 KB Partially correct
4 Partially correct 58 ms 284 KB Partially correct
5 Correct 3 ms 288 KB Output is correct
6 Correct 2 ms 200 KB Output is correct
7 Correct 14 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 200 KB Output is correct
2 Correct 23 ms 200 KB Output is correct
3 Partially correct 41 ms 200 KB Partially correct
4 Partially correct 49 ms 200 KB Partially correct
5 Correct 4 ms 200 KB Output is correct
6 Correct 3 ms 200 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
3 Partially correct 42 ms 200 KB Partially correct
4 Partially correct 69 ms 200 KB Partially correct
5 Correct 8 ms 200 KB Output is correct
6 Correct 8 ms 200 KB Output is correct
7 Correct 27 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 200 KB Output is correct
2 Correct 6 ms 200 KB Output is correct
3 Partially correct 86 ms 200 KB Partially correct
4 Partially correct 104 ms 200 KB Partially correct
5 Correct 10 ms 200 KB Output is correct
6 Correct 13 ms 200 KB Output is correct
7 Correct 23 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 200 KB Output is correct
2 Correct 11 ms 200 KB Output is correct
3 Partially correct 64 ms 200 KB Partially correct
4 Partially correct 66 ms 200 KB Partially correct
5 Correct 22 ms 200 KB Output is correct
6 Partially correct 41 ms 200 KB Partially correct
7 Partially correct 93 ms 200 KB Partially correct