QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#645178 | #5414. Stop, Yesterday Please No More | tsai | WA | 1ms | 3668kb | C++14 | 987b | 2024-10-16 17:09:41 | 2024-10-16 17:09:42 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct node{
int x;
int y;
}no[1000050];
void solve(){
int n;
scanf("%d",&n);
int minix=100005;
int st=0;
for(int i=0;i<=n-1;i++){
scanf("%d %d",&no[i].x,&no[i].y);
}
for(int i=0;i<n-1;i++){
if(no[i+1].y==no[i].y){
st++;
}else{
break;
}
}
int l=st,mid,r;
mid=(l+1)%n;r=(mid+1)%n;
int cnt=0;
while(1){
while(no[r].y==no[mid].y){
r=(r+1)%n;
}
if(r==(l+2)%n){
if(no[l].y>no[mid].y&&no[r].y>no[mid].y){
if(no[l].x<no[mid].x||no[mid].x<no[r].x){
cnt++;
}
}
}else{
if(no[l].y>no[mid].y&&no[r].y>no[mid].y){
if(no[(mid+1)%n].x>no[mid].x){
cnt++;
}
}
}
l=mid;mid++;
mid%=n;
r=(mid+1)%n;
if(l==st){
break;
}
}
printf("%d",cnt);
}
int main(){
int t=1;
// scanf("%d",&t);
while(t--){
solve();
if(t) printf("\n");
}
return 0;
}
/*
10
1 0
2 0
3 0
2 1
3 2
2 2
1 2
0 2
1 1
0 0
*/
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3668kb
input:
3 4 5 3 ULDDRR 4 5 0 UUUUUUU 4 5 10 UUUUUUU
output:
0
result:
wrong answer 1st numbers differ - expected: '2', found: '0'