# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152974 | 2019-09-11T02:00:29 Z | username | Two Dishes (JOI19_dishes) | C++14 | 236 ms | 30456 KB |
#include"bits/stdc++.h" using namespace std; #define LL long long #define PB push_back #define MP make_pair int N,M; LL A[1000000],B[1000000],S[1000000],T[1000000],P[1000000],Q[1000000],waA[1000000],waB[1000000],waP[1000000],waQ[1000000]; int main(){ scanf("%d%d", &N, &M); for(int i=0; i<N; i++) scanf("%lld%lld%lld", A+i, S+i, P+i); for(int i=0; i<M; i++) scanf("%lld%lld%lld", B+i, T+i, Q+i); for(int i=0; i<N; i++) waA[i] = (i==0 ? 0 : waA[i-1]) + A[i]; for(int i=0; i<M; i++) waB[i] = (i==0 ? 0 : waB[i-1]) + B[i]; for(int i=0; i<N; i++) waP[i] = (i==0 ? 0 : waP[i-1]) + P[i]; for(int i=0; i<M; i++) waQ[i] = (i==0 ? 0 : waQ[i-1]) + Q[i]; // int idx = upper_bound(waB, waB+M, S[0]) - waB - 1; LL ans = waQ[idx]; for(int i=0; i<N; i++){ if(waA[i] > S[0]) continue; LL nokori = S[0] - waA[i]; idx = upper_bound(waB, waB+M, nokori) - waB - 1; ans = max(ans, waP[i]+(idx==-1 ? 0 : waQ[idx])); //cout << i << " " << idx << endl; } cout << ans << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 221 ms | 16096 KB | Output is correct |
2 | Correct | 231 ms | 29560 KB | Output is correct |
3 | Correct | 222 ms | 29432 KB | Output is correct |
4 | Correct | 227 ms | 29496 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 236 ms | 28840 KB | Output is correct |
7 | Correct | 114 ms | 14952 KB | Output is correct |
8 | Correct | 115 ms | 15224 KB | Output is correct |
9 | Correct | 229 ms | 30456 KB | Output is correct |
10 | Correct | 160 ms | 23436 KB | Output is correct |
11 | Correct | 158 ms | 23912 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 221 ms | 16096 KB | Output is correct |
2 | Correct | 231 ms | 29560 KB | Output is correct |
3 | Correct | 222 ms | 29432 KB | Output is correct |
4 | Correct | 227 ms | 29496 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 236 ms | 28840 KB | Output is correct |
7 | Correct | 114 ms | 14952 KB | Output is correct |
8 | Correct | 115 ms | 15224 KB | Output is correct |
9 | Correct | 229 ms | 30456 KB | Output is correct |
10 | Correct | 160 ms | 23436 KB | Output is correct |
11 | Correct | 158 ms | 23912 KB | Output is correct |
12 | Incorrect | 2 ms | 376 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 221 ms | 16096 KB | Output is correct |
2 | Correct | 231 ms | 29560 KB | Output is correct |
3 | Correct | 222 ms | 29432 KB | Output is correct |
4 | Correct | 227 ms | 29496 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 236 ms | 28840 KB | Output is correct |
7 | Correct | 114 ms | 14952 KB | Output is correct |
8 | Correct | 115 ms | 15224 KB | Output is correct |
9 | Correct | 229 ms | 30456 KB | Output is correct |
10 | Correct | 160 ms | 23436 KB | Output is correct |
11 | Correct | 158 ms | 23912 KB | Output is correct |
12 | Incorrect | 2 ms | 376 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |