Submission #1002307

#TimeUsernameProblemLanguageResultExecution timeMemory
1002307yoav_sChess Rush (CEOI20_chessrush)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> v; typedef vector<v> vv; typedef vector<vv> vvv; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<vvb> vvvb; typedef pair<ll,ll> p; typedef vector<p> vp; typedef vector<vp> vvp; typedef vector<vvp> vvvp; typedef pair<ll, p> tri; typedef vector<tri> vtri; typedef vector<vtri> vvtri; typedef vector<vvtri> vvvtri; #define f first #define s second #define pb push_back #define eb emplace_back #define all(v) (v).begin(),(v).end() const ll INF = 1e18; const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll R, C, Q; cin >> R >> C >> Q; for (ll iter = 0; iter < Q; iter++) { char T; cin >> T; ll from, to; cin >> from >> to; if (T == 'P') { if (from == to) cout << "1 1\n"; else cout << "0 0\n"; } else if (T == 'R') { if (from == to) cout << "1 1\n"; else cout << "2 2\n"; } else if (T == 'Q') { if (from == to || (R == C && ((from == 1 && to == C) || (from == C && to == 1)))) cout << "1 1\n"; else { ll amt = 2; if ((from + 1) % 2 == (to + R) % 2) { if (R == C && (from == 1 || from == C)) amt++; if (R == C && (to == 1 || to == C)) amt++; amt += 2; ll t1 = (from - to + R - 1) / 2; if (from - t1 > 0) amt++; ll t2 = (to - from + R - 1) / 2; if (from + t2 <= C) amt++; } cout << "2 " << amt << "\n"; } } else cout << "-1 -1\n"; } return 0; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...