Submission #833142

# Submission time Handle Problem Language Result Execution time Memory
833142 2023-08-22T02:22:00 Z vjudge1 Exam (eJOI20_exam) C++17
0 / 100
5 ms 448 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++){
		if(t[i]==h[i]){
			tmp.pb(i);
		}
		cin >> t[i];
	}
	int ans=0;
	for(int ii=0; ii<tmp.size();ii++){
		
		int i=tmp[ii];
		cout << i << endl;
		vis[i]=1; ans++;
		int l=i, r=i;
		while(l-1>=1 && !vis[l-1]){
			l--;
			vis[l]=1;
			if(h[l]>h[i]) break;
			ans++;
		}
		while(r+1<=n && !vis[r+0]){
			r++;
			vis[r]=1;
			if(h[r]>h[i]) break;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Compilation message

exam.cpp: In function 'int main()':
exam.cpp:26:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for(int ii=0; ii<tmp.size();ii++){
      |                ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 324 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 5 ms 448 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -