Submission #283725

# Submission time Handle Problem Language Result Execution time Memory
283725 2020-08-26T06:14:29 Z 임성재(#5753) Ruka (COI15_ruka) C++17
9 / 100
2000 ms 1236 KB
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const ll inf = 1e9 + 7;

int n, m;
int x[100010];
int y[100010];

int main() {
	fast;

	cin >> n;

	for(int i=1; i<=n; i++) {
		cin >> x[i] >> y[i];
	}

	cin >> m;

	int cur = 1;

	while(m--) {
		char c;
		cin >> c;

		if(c == 'B') cur = max(1, cur - 1);
		else if(c == 'F') cur = min(n, cur + 1);
		else if(c == 'Q') {
			int ans = 0, sum = 1;
			
			int k = 1;
			for(int i=1; i<=n; i++) {
				sum += x[i];
				if(sum * k < 0) {
					k = -k;
					ans++;
				}
			}

			sum = 1, k = 1;
			for(int i=1; i<=n; i++) {
				sum += y[i];
				if(sum * k < 0) {
					k = -k;
					ans++;
				}
			}

			cout << ans << "\n";
		}
		else {
			cin >> x[cur] >> y[cur];
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Execution timed out 2073 ms 1236 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Execution timed out 2073 ms 1236 KB Time limit exceeded
6 Halted 0 ms 0 KB -