#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
int TC;
int A,W,H;
bool done[1000][1000];
int dx[9] = {0,0,0,-1,1,-1,1,-1,1};
int dy[9] = {0,-1,1,-1,1,0,0,1,-1};
int main(){
fast;
cin>>TC;
while (TC--){
cin>>A;
if (A == 20){
W = 4;
H = 5;
}else{
W = 40;
H = 5;
}
pi tl = pi(500,500);
pi br = pi(500 + W - 1,500 + H - 1);
mem(done,0);
FOR(i,tl.f,br.f){
FOR(j,tl.s,br.s){
while (!done[i][j]){
pi qry;
int curmn = 10;
FOR(k,0,8){
pi cur = pi(i+dx[k],j+dy[k]);
if (cur.f <= tl.f || cur.f >= br.f || cur.s <= tl.s || cur.s >= br.s) continue;
int num = 0;
FOR(l,0,8){
if (done[cur.f + dx[l]][cur.s + dy[l]]) num++;
}
if (num < curmn){
curmn = num;
qry = cur;
}
}
cout<<qry.f<<' '<<qry.s<<'\n';
cout.flush();
int a,b;
cin>>a>>b;
if (a == -1 && b == -1) return 0;
if (a == 0 && b == 0) return 0;
done[a][b] = 1;
}
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
1280 KB |
Unexpected end of file - token expected |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
1280 KB |
Unexpected end of file - token expected |