File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ #include < bits/stdc++.h>
2+ using namespace std ;
3+
4+
5+ #define ll long long
6+ #define endl " \n "
7+ #define debug (n ) cout<<(n)<<endl;
8+ const ll INF = 2e18 + 99 ;
9+
10+ int main (){
11+ ios_base::sync_with_stdio (false );
12+ cin.tie (NULL );
13+
14+ int t;
15+ cin>>t;
16+ while (t--){
17+ int n, m;
18+ cin>>n>>m;
19+ int check = 0 ;
20+ for (int i = 1 ; i <= n; i++){
21+ for (int j = 1 ; j <= m; j++){
22+ 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 )
23+ ||(j+2 <= m && i+1 <= n) || (j+2 <= m && i-1 >= 1 ) ||(j-2 >= 1 && i +1 <= n)||(j-2 >= 1 && i -1 >= 1 )){
24+ continue ;
25+ }
26+ else {
27+ cout<<i<<" " <<j<<endl;
28+ check = 1 ;
29+ }
30+ if (check){
31+ break ;
32+ }
33+ }
34+ if (check){
35+ break ;
36+ }
37+ }
38+ if (!check){
39+ cout<<1 <<" " <<1 <<endl;
40+ }
41+ }
42+
43+ }
You can’t perform that action at this time.
0 commit comments