QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133432#4935. Exchange Bottlenecksalvator_noster#WA 1ms3464kbC++14716b2023-08-02 09:25:572023-08-02 09:25:59

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 09:25:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3464kb
  • [2023-08-02 09:25:57]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;


#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(int i=a,i##end=b;i<=i##end;--i)

char IO;
int rd(int res=0){
	bool f=0;
	while(IO=getchar(),IO<48||IO>57)
		f|=IO=='-';
	do res=(res<<1)+(res<<3)+(IO^48);
	while(isdigit(IO=getchar()));
	return f?-res:res;
}
const int M=1e6+102;
int A[M];
int main(){
	int n=rd();
	bool fl=0,fl2=0;
	rep(i,2,n){
		A[i]=rd();
		if(i==2)A[i]=1;
		if(A[i]==0)fl=1;
		if(A[i]==1)fl2=1;
	}
	if(!fl){
		puts("1");
	}else {
		if(!fl2){
			printf("%d",n-1);
		}else{
			drep(i,n,2){
				if(A[i]){
					printf("%d",max(2,n-i+1));
					break;
				}
			}
		}
	}
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3464kb

input:

5
1 0 1 0

output:


result:

wrong answer 1st lines differ - expected: '2', found: ''