This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |