Submission #463383

# Submission time Handle Problem Language Result Execution time Memory
463383 2021-08-11T04:44:02 Z amunduzbaev Exam (eJOI20_exam) C++14
12 / 100
40 ms 3140 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 Correct 1 ms 204 KB Output is correct
2 Correct 7 ms 844 KB Output is correct
3 Correct 18 ms 1996 KB Output is correct
4 Correct 15 ms 1476 KB Output is correct
5 Correct 30 ms 3140 KB Output is correct
6 Correct 15 ms 1476 KB Output is correct
7 Correct 16 ms 1612 KB Output is correct
8 Correct 40 ms 2988 KB Output is correct
# 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 2 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 -