제출 #388737

#제출 시각아이디문제언어결과실행 시간메모리
388737AlexandraFountain (eJOI20_fountain)C++14
0 / 100
1 ms352 KiB
#include <iostream> #include <string> #include <vector> using namespace std; int N, Q; vector<long long int> d(N); vector<long long int> c(N); int a (vector <int>& litros, int k, int r, int v) { for (int k=r+1; k<=N; k++) { if (litros[k]>c[k]) { for (int l=k+1; l<=N; l++) { if (l==N) { return 0; } if (d[l]>d[k]) { v -= c[k]; litros[l]=v; k = a (litros, l, r, v); } else { return k; } } } } return 0; } int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> N >> Q; cin >> d[0] >> c[0]; for(int i=1; i<N; i++){ cin >> d[i] >> c[i]; } for (int j=0; j<Q; j++) { int r, v; cin >> r >> v; vector <int> litros (N, 0); litros[r-1]=v; int k = r; int resp = a (litros, k, r, v); cout << resp << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...