제출 #154579

#제출 시각아이디문제언어결과실행 시간메모리
154579stefdascaRuka (COI15_ruka)C++14
9 / 100
2036 ms2088 KiB
#include<bits/stdc++.h> #define fi first #define se second using namespace std; int n, q; pair<int, int> dir[100002]; char tip; int poz = 1, a, b; int lstque = -1; void brut() { int ans = 0; for(int i = 1; i <= q; ++i) { cin >> tip; if(tip == 'B') poz = max(1, poz - 1); if(tip == 'F') poz = min(poz + 1, n); if(tip == 'C') { cin >> a >> b; lstque = -1; dir[poz] = {a, b}; } if(tip == 'Q') { if(lstque == -1) { ans = 0; int pa = 1, pb = 1; for(int j = 1; j <= n; ++j) { if(pa > 0 && pa + dir[j].fi < 0) ++ans; if(pa < 0 && pa + dir[j].fi > 0) ++ans; if(pb > 0 && pb + dir[j].se < 0) ++ans; if(pb < 0 && pb + dir[j].se > 0) ++ans; pa += dir[j].fi; pb += dir[j].se; } lstque = i; } cout << ans << '\n'; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; for(int i = 1; i <= n; ++i) cin >> dir[i].fi >> dir[i].se; cin >> q; // if(1LL * n * q <= 300000000) // { brut(); return 0; // } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...