# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
883443 | 2023-12-05T09:40:44 Z | catlover | Ruka (COI15_ruka) | C++14 | 2000 ms | 3816 KB |
// Author : Hoang Van Tra - HSGS Bac Giang // Train VOI 2023 - 2024 #include <bits/stdc++.h> using namespace std; // -------------------------------------------------------INDEF----------------------------------------------------------------------- #define For(i, a, b) for (int i = a; i <= b; i++) #define Ford(i, a, b) for (int i = a; i >= b; i--) #define ll long long #define ii pair<int, int> #define fi first #define se second #define all(v) v.begin(), v.end() #define RRH(v) v.resize(unique(all(v)) - v.begin()) const int N = 1e6 + 7; const int M = 1e9 + 7; const ll oo = 1e18; const int block = 708; int n, q; ii a[N]; int solve() { int ans = 0; int x = 1, y = 1; int cur_x = 1; int cur_y = 1; For(i, 1, n) { x += a[i].fi; y += a[i].se; if (cur_x * x < 0) { ans++; cur_x = -cur_x; } if (cur_y * y < 0) { ans++; cur_y = -cur_y; } } return ans; } // -------------------------------------------------------ENDEF---------------------------------------------------------------------- int32_t main() { ios::sync_with_stdio(0); cin.tie(0); #define TASK "" if (fopen(".inp", "r")) { freopen(".inp", "r", stdin); freopen(".out", "w", stdout); } if (fopen(TASK ".inp", "r")) { freopen(TASK ".inp", "r", stdin); freopen(TASK ".out", "w", stdout); } cin >> n; For(i, 1, n) cin >> a[i].fi >> a[i].se; cin >> q; a[0] = { 1, 1 }; int pos = 1; while (q--) { char t; cin >> t; if (t == 'B') pos = max(1, pos - 1); if (t == 'F') pos = min(n, pos + 1); if (t == 'C') { int x, y; cin >> x >> y; a[pos] = { x, y }; } if (t == 'Q') cout << solve() << "\n"; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 1893 ms | 3004 KB | Output is correct |
6 | Correct | 842 ms | 1384 KB | Output is correct |
7 | Execution timed out | 2041 ms | 3816 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 2 ms | 348 KB | Output is correct |
5 | Correct | 1893 ms | 3004 KB | Output is correct |
6 | Correct | 842 ms | 1384 KB | Output is correct |
7 | Execution timed out | 2041 ms | 3816 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |