QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#133420 | #4935. Exchange Bottleneck | salvator_noster# | WA | 1ms | 3392kb | C++14 | 714b | 2023-08-02 09:17:56 | 2023-08-02 09:17:57 |
Judging History
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));
break;
}
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3392kb
input:
5 1 0 1 0
output:
result:
wrong answer 1st lines differ - expected: '2', found: ''