Submission #833152

# Submission time Handle Problem Language Result Execution time Memory
833152 2023-08-22T02:32:41 Z vjudge1 Exam (eJOI20_exam) C++17
0 / 100
12 ms 840 KB
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pb push_back
#define fi first
#define se second
using namespace std;
int n, h[100010], t[100010];
bool vis[100010];

//nitip doang mau pindah laptop

int main(){
	cin >> n;
	for(int i=1; i<=n; i++){
		cin >> h[i];
	}
	vector<int> tmp;
	for(int i=1; i<=n; i++){
		cin >> t[i];
		if(t[i]==h[i]){
			tmp.pb(i);
		}
	}
	int ans=0;
	for(auto i : tmp){
//		cout << i << endl;
		vis[i]=1; ans++;
		int l=i, r=i;
		while(l-1>=1 && !vis[l-1]){
//			cout << l << endl;
			l--;
			vis[l]=1;
			if(h[l]>h[i]) break;
			ans++;
		}
		while(r+1<=n && !vis[r+1]){
//			cout << r << endl;
			r++;
			vis[r]=1;
			if(h[r]>h[i]) break;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 212 KB Output is correct
2 Incorrect 12 ms 840 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -