Submission #833343

# Submission time Handle Problem Language Result Execution time Memory
833343 2023-08-22T04:44:54 Z vjudge1 Exam (eJOI20_exam) C++14
12 / 100
58 ms 1488 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
	//12 poin :))
	int n;
	cin>>n;
	vector<int> a(n+2),b(n+2),c(n+2);
	for(int i=1; i<=n; i++){
		cin>>a[i];
	}
	for(int i=1; i<=n; i++){
		cin>>b[i];
	}
	int x=b[1];
	for(int i=1; i<=n;i++){
		if(c[i]==1)continue;
		
		if(a[i]==x){
			c[i]=1;
			int j=i+1;
			while(a[j]<=x&&j<=n){
				a[j]=x;
				c[j]=1;
				j++;
			}
			
			j=i-1;
			while(a[j]<=x&&1<=j){
				if(c[j]==1)break;
				a[j]=x;
				c[j]=1;
				j--;
			}
			
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
//		cout<<a[i]<<" ";
		if(a[i]==b[i])ans++;
	}
	cout<<ans<<"\n";
	return 0;
}

/*
5
1 1 1 1 2
2 2 2 2 2 
*/
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 12 ms 528 KB Output is correct
3 Correct 36 ms 1344 KB Output is correct
4 Correct 22 ms 1488 KB Output is correct
5 Correct 58 ms 1464 KB Output is correct
6 Correct 22 ms 1484 KB Output is correct
7 Correct 26 ms 1464 KB Output is correct
8 Correct 56 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -