답안 #859053

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
859053 2023-10-09T15:19:24 Z vgtcross Flight to the Ford (BOI22_communication) C++17
15 / 100
18 ms 2936 KB
#include <bits/stdc++.h>

#define MODE 0

using namespace std;
using ll = long long;

int send(int s)
#if MODE
{
    cout << "send " << s << endl;
    cin >> s;
    return s;
}
#else
;
#endif

int receive()
#if MODE
{
    cout << "receive: " << flush;
    int s;
    cin >> s;
    return s;
}
#else
;
#endif

void encode(int n, int x) {
    if (x == 1) {
        send(1);
        send(1);
        send(1);
    } else {
        if (send(0)) send(3 - x);
        if (send(0)) send(3 - x);
    }
}

pair<int, int> decode(int n) {
    if (receive()) return {1, 3 - receive()};
    if (receive()) return {1, 3 - receive()};
    return {2, 3};
}

#if MODE
int main() {
    cin.tie(0) -> sync_with_stdio(0);
    
    int n, x;
    cin >> n >> x;
    encode(n, x);
    cout << "\n\nmode swich\n\n\n";
    pair<int, int> p = decode(n);
    cout << "! " << p.first << ' ' << p.second << endl;
}
#endif
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2772 KB Output is correct
2 Correct 5 ms 2780 KB Output is correct
3 Correct 7 ms 2736 KB Output is correct
4 Correct 5 ms 2772 KB Output is correct
5 Correct 3 ms 2936 KB Output is correct
6 Correct 14 ms 2840 KB Output is correct
7 Correct 18 ms 2780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 332 KB Not correct
2 Halted 0 ms 0 KB -