Submission #463382

# Submission time Handle Problem Language Result Execution time Memory
463382 2021-08-11T04:43:23 Z amunduzbaev Exam (eJOI20_exam) C++14
0 / 100
3 ms 332 KB
#include "bits/stdc++.h"
using namespace std;

//~ #define int long long

void solve1(int n){
	vector<int> a(n), b(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) cin>>b[i];
	vector<int> dp(n);
	if(n <= 200){
		
	} else {
		
	}
}

void solve2(int n){
	vector<int> a(n), b(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) cin>>b[i];
	
	int last = 0, cnt = 0, res = 0;
	for(int i=0;i<n;i++){
		if(a[i] > b[0]){
			if(cnt){
				res += (i - last);
			}
			
			cnt = 0, last = i + 1;
		} else {
			cnt |= (a[i] == b[i]);
		}
	} if(cnt){
		res += (n - last);
	}
	
	cout<<res<<"\n";
}

void solve(){
	int n; cin>>n;
	if(n <= 5005){
		solve1(n);
	} else {
		solve2(n);
	}
}

/*

3
1 2 3
2 2 2

*/

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	//~ cin>>t;
	while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -