# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
576614 |
2022-06-13T08:39:02 Z |
Yazan_SA |
Exam (eJOI20_exam) |
C++14 |
|
15 ms |
1200 KB |
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define start cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
using namespace std;
int main()
{
start
//freopen("survive.in", "r", stdin);
int t=1;
//cin>>t;
while(t--)
{
int n, arr[100000], arrb[100000];
cin>>n;
int ans=0;
for(int i=0; i<n; cin>>arr[i++]);
for(int i=0; i<n; cin>>arrb[i++]);
for(int i=0; i<n; i++)
{
int mn=1e9+1;
bool is=1;
if(arr[i]>arrb[i])
continue;
if(arr[i]==arrb[i])
{
ans++;
is=0;
}
mn=1e9;
for(int j=i-1; j>=0&&is; j--)
{
mn=min(mn, arrb[j]);
if(i==j)
continue;
if(arrb[i]==arr[j] && mn>=arr[j])
{
ans++;
is=0;
}
}
mn=1e9;
for(int j=i+1; j<n&&is; j++)
{
mn=min(mn, arrb[j]);
if(i==j)
continue;
if(arrb[i]==arr[j] && mn>=arr[j])
{
ans++;
is=0;
}
}
}
cout<<ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1096 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1120 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
1200 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1096 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1096 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |