답안 #230940

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
230940 2020-05-12T03:34:26 Z jiahng Go, Gopher! (GCJ18Q_gogopher) C++14
0 / 30
10000 ms 1280 KB
#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 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){
				pi qry = pi(i,j);
				
				while (qry.s + 1 > br.s) qry.s--;
				while (qry.f + 1 > br.f) qry.f--;
				while (qry.s - 1 < tl.s) qry.s++;
				while (qry.f - 1 < tl.f) qry.f++;
				
				while (!done[i][j]){
					//cout<<i<<' '<<j<<'\n';
					cout<<qry.f<<' '<<qry.s<<'\n';
					cout.flush();
					
					int a,b;
					cin>>a>>b;
					done[a][b] = 1;
				}
			}
		}
		
	}
}

# 결과 실행 시간 메모리 Grader output
1 Execution timed out 10071 ms 1280 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 10075 ms 1280 KB Time limit exceeded