# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
576509 | 2022-06-13T07:02:14 Z | Yazan_SA | Fountain (eJOI20_fountain) | C++14 | 76 ms | 3528 KB |
#include<bits/stdc++.h> #define ll long long #define endl "\n" #define start cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); using namespace std; bool iscnt[100000]; int main() { start //freopen("survive.in", "r", stdin); int t=1; //cin>>t; while(t--) { ll n, q, d, c, r, val; vector<pair<int,int>>v; ll pref[100000]; cin>>n>>q; for(int i=0; i<n; i++) { int x, y; cin>>x>>y; v.push_back({x, y}); } pref[0]=v[0].second; for(int i=1; i<n; i++) { pref[i]=pref[i-1]+v[i].second; /*if(iscnt[i]==0) { iscnt[i]=1; pref[i]=v[i].second; for(int j=i+1; j<n; j++) { if(v[j]<=v[i]) break; iscnt[j]=1; } }*/ } for(int i=0; i<n; cout<<pref[i++]<<' '); cout<<endl; while(q--) { cin>>r>>val; bool is=0; if(val>pref[n-1]-pref[r-2] && r>1) cout<<0; else if(val>pref[n-1] && r==1) cout<<0; else { if(r>1) val+=pref[r-2]; cout<<lower_bound(pref+r-1, pref+n, val)-pref+1; } cout<<endl; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 980 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 76 ms | 3528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 980 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |