# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
883388 | txk_2k6 | Ruka (COI15_ruka) | C++17 | 2 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll 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;
}
int 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';
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |