Submission #576598

#TimeUsernameProblemLanguageResultExecution timeMemory
576598emad234Exam (eJOI20_exam)C++17
12 / 100
21 ms1108 KiB
#include <bits/stdc++.h> #define all(v) ((v).begin(),(v).end()) typedef long long ll; using namespace std; const int mod = 1e9 + 7; const int mxN = 2e6 + 1; int a[mxN]; int b[mxN]; int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n; cin >>n; for(int i =0;i < n;i++){ cin >>a[i]; } for(int i = 0;i < n;i++){ cin >>b[i]; } for(int i = 0;i < n;i++){ if(a[i] == b[i]){ for(int j = i + 1;j < n;j++){ if(a[j] < b[i]){ a[j] = b[i]; }else break; } for(int j = i - 1;j >= 0;j--){ if(a[j] < b[i]){ a[j] = b[i]; }else break; } } } int ans = 0; for(int i =0;i < n;i++){ if(a[i] == b[i]) ans++; } cout <<ans; } // nice
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...