# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
833871 |
2023-08-22T09:15:22 Z |
vjudge1 |
Exam (eJOI20_exam) |
C++17 |
|
19 ms |
4664 KB |
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define int long long
#define pb push_back
#define fi first
#define se second
#define mp make_pair
const int mod = 1e9 + 7;
const int maxn = 2e6 + 5;
int32_t main()
{
IOS
int n; cin >> n;
int h[n + 1], t[n + 1];
for(int i = 1; i <= n; i++){
cin >> h[i];
}
bool sama = true;
cin >> t[1];
for(int i = 2; i <= n; i++){
cin >> t[i];
if(t[i] != t[i - 1])sama = false;
}
if(sama){
int tmp = t[1];
int ada = 0, kurang = 0, lebih = 0;
vector<int> idx;
for(int i = 1; i <= n; i++){
if(h[i] == tmp){
ada++;
idx.pb(i);
}else if(h[i] < tmp){
kurang++;
}else{
lebih++;
}
}
int ans = ada;
int tanda[n + 1] = {false};
for(auto i : idx){
int idx = i - 1;
if(idx > 0){
while(h[i] >= h[idx] && idx >= 1){
if(tanda[idx] || h[idx] == h[i]){
break;
}
tanda[idx] = 1;
ans++;
idx--;
}
}
idx = i + 1;
if(idx <= n){
while(h[i] >= h[idx] && idx <= n){
if(tanda[idx] || h[idx] == h[i]){
break;
}
tanda[idx] = 1;
ans++;
idx++;
}
}
// for(int i = 1; i <= n; i++){
// cout << tanda[i] << " ";
// }cout << endl;
}
cout << ans << endl;
// if(ada == 0){
// cout << 0 << endl;
// }else{
// cout << ada + kurang << endl;
// }
//cout << kurang << " " << lebih << " " << ada << endl;
}
}
# |
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 |
6 ms |
852 KB |
Output is correct |
3 |
Correct |
11 ms |
3396 KB |
Output is correct |
4 |
Correct |
9 ms |
3044 KB |
Output is correct |
5 |
Correct |
19 ms |
4664 KB |
Output is correct |
6 |
Correct |
10 ms |
3404 KB |
Output is correct |
7 |
Correct |
11 ms |
3272 KB |
Output is correct |
8 |
Correct |
17 ms |
4552 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 |
1 ms |
340 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 |
- |