# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
105844 | 2019-04-15T10:35:07 Z | Pro_ktmr | Two Dishes (JOI19_dishes) | C++14 | 271 ms | 30396 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 | 205 ms | 29708 KB | Output is correct |
2 | Correct | 244 ms | 29560 KB | Output is correct |
3 | Correct | 218 ms | 29584 KB | Output is correct |
4 | Correct | 210 ms | 29508 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 196 ms | 28768 KB | Output is correct |
7 | Correct | 108 ms | 14924 KB | Output is correct |
8 | Correct | 114 ms | 15156 KB | Output is correct |
9 | Correct | 271 ms | 30396 KB | Output is correct |
10 | Correct | 169 ms | 23416 KB | Output is correct |
11 | Correct | 165 ms | 23800 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 205 ms | 29708 KB | Output is correct |
2 | Correct | 244 ms | 29560 KB | Output is correct |
3 | Correct | 218 ms | 29584 KB | Output is correct |
4 | Correct | 210 ms | 29508 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 196 ms | 28768 KB | Output is correct |
7 | Correct | 108 ms | 14924 KB | Output is correct |
8 | Correct | 114 ms | 15156 KB | Output is correct |
9 | Correct | 271 ms | 30396 KB | Output is correct |
10 | Correct | 169 ms | 23416 KB | Output is correct |
11 | Correct | 165 ms | 23800 KB | Output is correct |
12 | Incorrect | 2 ms | 384 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 205 ms | 29708 KB | Output is correct |
2 | Correct | 244 ms | 29560 KB | Output is correct |
3 | Correct | 218 ms | 29584 KB | Output is correct |
4 | Correct | 210 ms | 29508 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 196 ms | 28768 KB | Output is correct |
7 | Correct | 108 ms | 14924 KB | Output is correct |
8 | Correct | 114 ms | 15156 KB | Output is correct |
9 | Correct | 271 ms | 30396 KB | Output is correct |
10 | Correct | 169 ms | 23416 KB | Output is correct |
11 | Correct | 165 ms | 23800 KB | Output is correct |
12 | Incorrect | 2 ms | 384 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |