Submission #1137595

#TimeUsernameProblemLanguageResultExecution timeMemory
1137595ghammazhassanNaval battle (CEOI24_battle)C++20
0 / 100
0 ms328 KiB
// #include <bits/stdc++.h> #include <iostream> #include <cmath> #include <algorithm> #include <map> #include <vector> #include <iomanip> #include <string> #include <queue> #include <set> using namespace std; #define int long long #define endl "\n"; const int N=2e5+5; const int M=1e9+7; int n; double p; void solve2() { string s,r; for (int i=0;i<n;i++){ s+='0'; r+='0'; } for (int i=0;i<n;i++){ s[i]='1'; cout << "Q " << s << endl; char u; cin >> u; if (u=='P'){ r[i]='1'; } s[i]='0'; } cout << "A " << r << endl; char e; cin >> e; if (e=='C'){ return; } else{ exit(0); } } void solve() { int n; cin >> n; if (n==2){ int x1,y1,x2,y2; char s1,s2; cin >> x1 >> y1 >> s1 >> x2 >> y2 >> s2; if (s1==s2){ cout << 1 << endl; cout << 2 << endl; return; } if (s1=='S' and s2=='N'){ if (y1>y2 or x1!=x2){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='N' and s2=='S'){ if (y1<y2 or x1!=x2){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='E' and s2=='W'){ if (x1>x2 or y1!=y2){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='W' and s2=='E'){ if (x1<x2 or y1!=y2){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='S' and s2=='E'){ if (x2-x1!=y1-y2){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='E' and s2=='S'){ if (x1-x2!=y2-y1){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='S' and s2=='W'){ if (-x1+x2!=y1-y2){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='W' and s2=='S'){ if (-x2+x1!=y2-y1){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='N' and s2=='E'){ if (x2-x1!=-y1+y2){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='E' and s2=='N'){ if (x1-x2!=-y2+y1){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='N' and s2=='W'){ if (-x1+x2!=-y1+y2){ cout << 1 << endl; cout << 2 << endl; } return; } if (s1=='W' and s2=='N'){ if (-x2+x1!=-y2+y1){ cout << 1 << endl; cout << 2 << endl; } return; } } } signed main() { ios::sync_with_stdio(0);//DO NOT USE IN INTERACTIVE cin.tie(0), cout.tie(0);//DO NOT USE IN INTERACTIVE cout << fixed<<setprecision(9); int t=1; // cin >> t; for (int _=1;_<=t;_++){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...