Submission #572418

#TimeUsernameProblemLanguageResultExecution timeMemory
572418PiejanVDCPilot (NOI19_pilot)C++17
40 / 100
1092 ms1868 KiB
#include <bits/stdc++.h> using namespace std; signed main() { int n,q; cin>>n>>q; vector<int>v(n); for(auto &z : v) { cin>>z; } v.push_back(INT_MAX); while(q--) { int h; cin>>h; int cnt = 0; long long ans = 0; for(int i = 0 ; i <= n ; i++) { if(v[i] <= h) { cnt++; } else { ans += (cnt * (cnt+1))/2; cnt = 0; } } cout << ans << '\n'; } }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...