#include <bits/stdc++.h>
#define ll long long
#define int long long
using namespace std;
const int mx= 1e5+5;
int n, m;
struct dl{
int x, y;
};
dl a[mx];
int res(){
int x=1, y=1, d=0;
for (int i=1; i<=n; i++){
int x1=x+a[i].x;
int y1=y+a[i].y;
if (x1*x<=0 && x!=0 ) d++;
if (y1*y<=0 && y!=0) d++;
x=x1;
y=y1;
}
return d;
}
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
//freopen("simulation.inp","r",stdin);
//freopen("simulation.out","w",stdout);
cin >> n;
for (int i=1; i<=n; i++) cin >> a[i].x >> a[i].y;
cin >> m;
int i=1;
while (m--){
char c; cin >> c;
if (c=='B'){
if (i!=1) i--;
continue;
}
if (c=='F'){
if (i!=n) i++;
continue;
}
if (c=='C'){
int x, y;
cin >> x >> y;
//cout << i<<'\n';
a[i].x=x;
a[i].y=y;
continue;
}
//for (int i=1; i<=n; i++) cout << a[i].x <<' '<<a[i].y<<'\n';
cout << res() <<'\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
5 |
Execution timed out |
2072 ms |
1184 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
5 |
Execution timed out |
2072 ms |
1184 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |