# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
122811 | 2019-06-29T10:19:06 Z | WhipppedCream | Two Dishes (JOI19_dishes) | C++17 | 212 ms | 24200 KB |
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; const int maxn = 1e6+5; int n, m; ll a[maxn]; ll b[maxn]; ll p[maxn]; ll q[maxn]; ll s[maxn]; ll t[maxn]; int find_end(ll k) { return upper_bound(b+1, b+m+1, k)-b-1; } int main() { scanf("%d %d", &n, &m); for(int i = 1; i<= n; i++) scanf("%lld %lld %lld", &a[i], &s[i], &p[i]); for(int i = 1; i<= m; i++) scanf("%lld %lld %lld", &b[i], &t[i], &q[i]); ll lim = t[1]; for(int i = 1; i<= m; i++) { b[i] += b[i-1]; q[i] += q[i-1]; } ll run = 0; ll cum = 0; ll best = -1e18; best = max(best, q[find_end(lim)]); for(int i = 1; i<= n; i++) { run += a[i]; if(run> lim) break; cum += p[i]; best = max(best, cum+q[find_end(lim-run)]); } printf("%lld\n", best); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 205 ms | 9720 KB | Output is correct |
2 | Correct | 203 ms | 9652 KB | Output is correct |
3 | Correct | 201 ms | 9848 KB | Output is correct |
4 | Correct | 202 ms | 9652 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 212 ms | 22776 KB | Output is correct |
7 | Correct | 100 ms | 11896 KB | Output is correct |
8 | Correct | 105 ms | 12016 KB | Output is correct |
9 | Correct | 211 ms | 24200 KB | Output is correct |
10 | Correct | 153 ms | 17232 KB | Output is correct |
11 | Correct | 154 ms | 17500 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 205 ms | 9720 KB | Output is correct |
2 | Correct | 203 ms | 9652 KB | Output is correct |
3 | Correct | 201 ms | 9848 KB | Output is correct |
4 | Correct | 202 ms | 9652 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 212 ms | 22776 KB | Output is correct |
7 | Correct | 100 ms | 11896 KB | Output is correct |
8 | Correct | 105 ms | 12016 KB | Output is correct |
9 | Correct | 211 ms | 24200 KB | Output is correct |
10 | Correct | 153 ms | 17232 KB | Output is correct |
11 | Correct | 154 ms | 17500 KB | Output is correct |
12 | Incorrect | 2 ms | 376 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 205 ms | 9720 KB | Output is correct |
2 | Correct | 203 ms | 9652 KB | Output is correct |
3 | Correct | 201 ms | 9848 KB | Output is correct |
4 | Correct | 202 ms | 9652 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 212 ms | 22776 KB | Output is correct |
7 | Correct | 100 ms | 11896 KB | Output is correct |
8 | Correct | 105 ms | 12016 KB | Output is correct |
9 | Correct | 211 ms | 24200 KB | Output is correct |
10 | Correct | 153 ms | 17232 KB | Output is correct |
11 | Correct | 154 ms | 17500 KB | Output is correct |
12 | Incorrect | 2 ms | 376 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |