#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 |
- |