제출 #388740

#제출 시각아이디문제언어결과실행 시간메모리
388740AlmaFountain (eJOI20_fountain)C++17
0 / 100
1580 ms1940 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, q, r, v; cin >> n >> q; vector<pair<int,int>> vii (n); // {diameter, capacity} for (int i = 0; i < n; i++) cin >> vii[i].first >> vii[i].second; sort(vii.begin(), vii.end()); while (q--) { cin >> r >> v; for (int i = r-1; i < n; i++) { v -= vii[i].second; if (v > 0 && i == n-1) { cout << 0 << '\n'; } else if (v <= 0) { cout << i+1 << '\n'; break; } else { continue; } } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...