-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy path1739A.cpp
43 lines (38 loc) · 858 Bytes
/
1739A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
int n, m;
cin>>n>>m;
int check = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
if((i + 2 <= n && j+1 <= m)||(i + 2 <= n && j-1 >= 1)||(i-2 >= 1 && j +1 <= m)||(i-2 >= 1 && j -1 >= 1)
||(j+2 <= m && i+1 <= n) || (j+2 <= m && i-1 >= 1) ||(j-2 >= 1 && i +1 <= n)||(j-2 >= 1 && i -1 >= 1)){
continue;
}
else{
cout<<i<<" "<<j<<endl;
check = 1;
}
if(check){
break;
}
}
if(check){
break;
}
}
if(!check){
cout<<1<<" "<<1<<endl;
}
}
}