Submission #601536

# Submission time Handle Problem Language Result Execution time Memory
601536 2022-07-22T07:32:31 Z 반딧불(#8472) Flight to the Ford (BOI22_communication) C++17
15 / 100
34 ms 1844 KB
#include "communication.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

void anna(int X){
    if(X==0){
        int tmp = send(0);
        if(!tmp){
            tmp = send(0);
            if(!tmp) send(0);
            else send(1);
        }
        else send(0), send(0);
    }
    else if(X==1){
        int tmp = send(0);
        if(!tmp) send(0), send(0);
        else send(1), send(1);
    }
    else{
        int tmp = send(1);
        if(tmp){
            tmp = send(1);
            if(tmp) send(1);
            else send(0);
        }
        else send(1), send(0);
    }
}

int decode(int A, int B, int C){
    return vector<int> {0, 0, 1, 2, 2, 0, 1, 1} [A*4+B*2+C];
}

void encode(int N, int X){
    X--;
    anna(X);
}

pair<int, int> decode(int N){
    int A = receive(), B = receive(), C = receive();
    int tmp = decode(A, B, C);
    return make_pair(tmp+1, (tmp+1)%3+1);
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1740 KB Output is correct
2 Correct 7 ms 1684 KB Output is correct
3 Correct 12 ms 1728 KB Output is correct
4 Correct 9 ms 1844 KB Output is correct
5 Correct 10 ms 1800 KB Output is correct
6 Correct 21 ms 1728 KB Output is correct
7 Correct 34 ms 1688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 200 KB Not correct
2 Halted 0 ms 0 KB -