QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#645178#5414. Stop, Yesterday Please No MoretsaiWA 1ms3668kbC++14987b2024-10-16 17:09:412024-10-16 17:09:42

Judging History

你现在查看的是最新测评结果

  • [2024-10-16 17:09:42]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3668kb
  • [2024-10-16 17:09:41]
  • 提交

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
*/

Details

Tip: Click on the bar to expand more detailed information

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'