#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#ifdef TEST
#define getchar_unlocked _getchar_nolock
#endif
#define int long long
#define ins insert
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define pp pop
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define g0(a) get<0>(a)
#define g1(a) get<1>(a)
#define g2(a) get<2>(a)
#define g3(a) get<3>(a)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef double db;
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef tree<pair<int, int>, null_type, less<pair<int, int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ii cent[] = {{2, 2}, {2, 5}, {2, 8}, {2, 11}, {2, 14},
{5, 2}, {5, 5}, {5, 8}, {5, 11}, {5, 14},
{8, 2}, {8, 5}, {8, 8}, {8, 11}, {8, 14},
{11, 2}, {11, 5}, {11, 8}, {11, 11}, {11, 14},
{14, 2}, {14, 5}, {14, 8}, {14, 11}, {14, 14}};
int T, A, tmp1, tmp2, dr[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1}, dc[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
main() {
cin >> T;
while (T--) {
cin >> A;
bool done = 0;
for (auto i : cent) {
set<ii> S;
for (int k = 0; k < 9; k++)
S.emplace(i.first + dr[k], i.second + dc[k]);
while (!S.empty()) {
cout << i.first << ' ' << i.second << endl;
cin >> tmp1 >> tmp2;
if (!tmp1 && !tmp2) {
done = 1;
break;
}
if (S.find(mp(tmp1, tmp2)) != S.end()) S.erase(mp(tmp1, tmp2));
}
if (done) break;
}
}
}
Compilation message
gogopher.cpp:37:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main() {
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
106 ms |
256 KB |
Output is correct |