Submission #230939

# Submission time Handle Problem Language Result Execution time Memory
230939 2020-05-12T03:32:51 Z jiahng Go, Gopher! (GCJ18Q_gogopher) C++14
0 / 30
10000 ms 384 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;
				}
			}
		}
		
	}
}

# Verdict Execution time Memory Grader output
1 Execution timed out 13 ms 384 KB Time limit exceeded (wall clock)
# Verdict Execution time Memory Grader output
1 Execution timed out 10061 ms 384 KB Time limit exceeded