Submission #833391

#TimeUsernameProblemLanguageResultExecution timeMemory
833391vjudge1Exam (eJOI20_exam)C++17
12 / 100
16 ms1904 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<ll> h(n); vector<ll> t(n); for(int i = 0 ; i < n ; i++){ cin >> h[i]; } for(int i = 0 ; i < n ; i++){ cin >> t[i]; } bool tbeh = 0; int ta = t[0], l = -1, ans = 0; for(int i = 0 ; i < n ; i++){ if(h[i] < ta){ if(tbeh){ ans++; }else if(l == -1){ l = i; } }else if( h[i] > ta){ tbeh = 0; l = -1; }else{ if( l != -1){ ans += i-l; } l = -1; ans++; tbeh = 1; } } cout << ans; return 0; }
#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...