General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
187505339 Practice:
DaiRuiChen007
1666I - 17 C++14 (GCC 6-32) Accepted 15 ms 4 KB 2023-01-01 11:49:42 2023-01-01 11:49:42
→ Source
// LUOGU_RID: 98435014
#include<bits/stdc++.h>
using namespace std;
inline int read(int r,int c) {
	cout<<"SCAN "<<r<<" "<<c<<endl;
	int ret; cin>>ret; return ret; 
}
inline bool chk(int x,int y,int r1,int c1,int r2,int c2,int d) {
	return abs(x-r1)+abs(x-r2)+abs(y-c1)+abs(y-c2)==d;
}
inline void solve() {
	int n,m;
	cin>>n>>m;
	vector <int> r(4),c(4),v(4);
	v[0]=read(r[0]=1,c[0]=1);
	v[1]=read(r[1]=1,c[1]=m);
	int sr=((v[0]+4)+(v[1]+2-2*m))/2;
	int sc=((v[0]+4)-(v[1]+2-2*m))/2;
	v[2]=read(r[2]=1,c[2]=sc/2);
	v[3]=read(r[3]=sr/2,c[3]=1);
	for(int r1=1;r1<=n;++r1) for(int c1=1;c1<=m;++c1) {
		for(int r2=1;r2<=n;++r2) for(int c2=1;c2<=m;++c2)  {
			bool ok=true;
			for(int k:{0,1,2,3}) {
				if(!chk(r[k],c[k],r1,c1,r2,c2,v[k])) {
					ok=false;
					break;
				}
			}
			if(ok) {
				int s;
				cout<<"DIG "<<r1<<" "<<c1<<endl; cin>>s;
				if(s==1) {
					cout<<"DIG "<<r2<<" "<<c2<<endl; cin>>s;
				} else {
					cout<<"DIG "<<r1<<" "<<c2<<endl; cin>>s;
					cout<<"DIG "<<r2<<" "<<c1<<endl; cin>>s;
				}
				return ;
			}
		}	
	}
}
signed main() {
	int T;
	scanf("%d",&T);
	while(T--) solve();
	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details