Submission #740753

# Submission time Handle Problem Language Result Execution time Memory
740753 2023-05-13T04:20:44 Z fastbee23 Exam (eJOI20_exam) C++17
0 / 100
1 ms 340 KB
/*
> 221
*/

#include <bits/stdc++.h>
using namespace std;

#define drop(x) cout<<x<<endl;return;
#define debug(arr,a,b) for(auto v:arr){cout<<v<<a;}cout<<b;
#define debugc(arr,a,b) for(auto v:arr){cerr<<v<<a;}cerr<<b;
#define print(arr)  for(auto v:arr){cout<<v<<" ";}cout<<"\n";
#define all(arr)    (arr).begin(),(arr).end()
#define sz(s)       (s).size()
#define vi          vector<int>
#define endl        "\n"
#define pb      push_back
#define ins     insert
#define mp      make_pair
#define int     long long int
#define str     string

const int mod = 1e9 + 7;
const int inf = LLONG_MAX;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

namespace HHO{
    void in(vector<int> &arr){
        for(auto &v:arr){
            cin>>v;
        }
    }
    vector<int> sorted(vector<int> arr){
        vector<int> sortme=arr;
        sort(all(sortme));
        return sortme;
    }
    string reversed(string s){
        return string(s.rbegin(),s.rend());
    }
};using namespace HHO;

void h221(){    
    int n;
    cin>>n;
    vector<int> arr(n);
    vector<int> brr(n);
    int mx=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        mx=max(mx,arr[i]);
    }
    int cnt=0;
    for(int i=0;i<n;i++){
        cin>>brr[i];
        if(brr[i]>arr[i]){
            int mxc=arr[i];
            if(i>=0){
                mxc=arr[i-1];
            }
            if(i+1<n){
                mxc=max(mxc,arr[i+1]);
            }
            arr[i]=mxc;
            if(brr[i]<=arr[i]){
                cnt++;
            }
        }
    }
    drop(cnt);
}


signed main(){
    // freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);
    cin.tie(0)->sync_with_stdio(0);
    int T = 1;
    // cin>>T;
    while(T--){
        h221();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 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 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 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -