답안 #601536

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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);
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 200 KB Not correct
2 Halted 0 ms 0 KB -