Submission #931427

# Submission time Handle Problem Language Result Execution time Memory
931427 2024-02-21T19:00:34 Z kirakosyan Fountain (eJOI20_fountain) C++17
0 / 100
180 ms 3284 KB
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<random>
#include<cmath>
#include<stack>
#include<map>
#include <iomanip> 
#include <queue>
#include <set>
using namespace std;
using ll = long long;
using ull = unsigned long long;
vector<ll>v,vis;
vector<vector<ll>>gp;
void solve(){
    ll n,q; cin >> n >> q;
    vector<ll>d(n),c(n),pref(n);
    for(ll i=0;i<n;i++)cin >> d[i] >> c[i];
    pref[0]=c[0];
    for(ll i=1;i<n;i++){
        pref[i]=pref[i-1]+c[i];
    }
    // for(ll i=0;i<n;i++){
    //     cout<<pref[i]<<" ";
    // }
    // cout<<endl;
    for(ll i=0;i<q;i++){
        ll a,b; cin >> a >> b;
        --a;
        if(a!=0){
            a--;
            ll k=lower_bound(pref.begin(),pref.end(),pref[a]+b)-pref.begin();
            cout<<k<<endl;
        }
        else{
            ll k=lower_bound(pref.begin(),pref.end(),b)-pref.begin();
            cout<<k<<endl;
        }
    }
}
signed main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL); cin.tie(nullptr);
	 // ll _; cin >> _;
  //     while (_--){
        solve();
   // }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 180 ms 3284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -