Submission #833239

#TimeUsernameProblemLanguageResultExecution timeMemory
833239vjudge1Exam (eJOI20_exam)C++17
0 / 100
12 ms1108 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<int> h(n); vector<int> t(n); for(int i = 0 ; i < n ; i++) { cin >> h[i]; } for(int i = 0 ; i < n ; i++) { cin >> t[i]; } // T sama semua int T = t[0]; int l = -1; int ans = 0; bool Tfnd = 0; for(int i = 0 ; i < n ; i++){ //cout << T << endl; if(h[i] < T){ if(Tfnd){ //cout << "hm"; ans++; }else if(l == -1){ l = i; } }else if(h[i] > T){ l = -1; Tfnd = 0; }else{ //cout <<"yay"; Tfnd =1; if(l != -1){ ans += i-l; } ans++; } } 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...