# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1069736 |
2024-08-22T08:37:00 Z |
정희우(#11134) |
Two Dishes (JOI19_dishes) |
C++17 |
|
23 ms |
32092 KB |
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
using lint = long long;
using vint = vector<int>;
using pii = pair<int,int>;
const int MAX_N=2010;
const lint INF=2.1e+15;
int n,m;
lint t1[MAX_N],t2[MAX_N],c1[MAX_N],c2[MAX_N],s1[MAX_N],s2[MAX_N];
lint ts1[MAX_N],ts2[MAX_N],ci1[MAX_N],ci2[MAX_N];
lint dt[MAX_N][MAX_N];
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin >> n >> m;
for(int i=1;i<=n;i++)
{
cin >> t1[i] >> c1[i] >> s1[i];
ts1[i]=t1[i]+ts1[i-1];
}
for(int i=1;i<=m;i++)
{
cin >> t2[i] >> c2[i] >> s2[i];
ts2[i]=t2[i]+ts2[i-1];
}
for(int i=1;i<=n;i++)
ci1[i]=upper_bound(ts2,ts2+m+1,c1[i]-ts1[i])-ts2-1;
for(int i=1;i<=m;i++)
ci2[i]=upper_bound(ts1,ts1+n+1,c2[i]-ts2[i])-ts1-1;
fill(dt[0],dt[0]+MAX_N*MAX_N,-INF);
dt[0][0]=0;
for(int i=0;i<=n;i++)
for(int j=0;j<=m;j++)
{
lint s=s1[i+1]*(j<=ci1[i+1]);
dt[i+1][j]=max(dt[i+1][j],dt[i][j]+s);
s=s2[j+1]*(i<=ci2[j+1]);
dt[i][j+1]=max(dt[i][j+1],dt[i][j]+s);
}
cout << dt[n][m];
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
856 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
32092 KB |
Output is correct |
2 |
Correct |
6 ms |
31940 KB |
Output is correct |
3 |
Correct |
6 ms |
32092 KB |
Output is correct |
4 |
Correct |
6 ms |
32092 KB |
Output is correct |
5 |
Correct |
6 ms |
32092 KB |
Output is correct |
6 |
Correct |
6 ms |
32092 KB |
Output is correct |
7 |
Correct |
6 ms |
32088 KB |
Output is correct |
8 |
Correct |
11 ms |
31928 KB |
Output is correct |
9 |
Correct |
7 ms |
32092 KB |
Output is correct |
10 |
Correct |
6 ms |
32092 KB |
Output is correct |
11 |
Correct |
6 ms |
32092 KB |
Output is correct |
12 |
Correct |
6 ms |
32088 KB |
Output is correct |
13 |
Correct |
6 ms |
32092 KB |
Output is correct |
14 |
Correct |
6 ms |
31948 KB |
Output is correct |
15 |
Correct |
6 ms |
32092 KB |
Output is correct |
16 |
Correct |
6 ms |
32092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
32092 KB |
Output is correct |
2 |
Correct |
6 ms |
31940 KB |
Output is correct |
3 |
Correct |
6 ms |
32092 KB |
Output is correct |
4 |
Correct |
6 ms |
32092 KB |
Output is correct |
5 |
Correct |
6 ms |
32092 KB |
Output is correct |
6 |
Correct |
6 ms |
32092 KB |
Output is correct |
7 |
Correct |
6 ms |
32088 KB |
Output is correct |
8 |
Correct |
11 ms |
31928 KB |
Output is correct |
9 |
Correct |
7 ms |
32092 KB |
Output is correct |
10 |
Correct |
6 ms |
32092 KB |
Output is correct |
11 |
Correct |
6 ms |
32092 KB |
Output is correct |
12 |
Correct |
6 ms |
32088 KB |
Output is correct |
13 |
Correct |
6 ms |
32092 KB |
Output is correct |
14 |
Correct |
6 ms |
31948 KB |
Output is correct |
15 |
Correct |
6 ms |
32092 KB |
Output is correct |
16 |
Correct |
6 ms |
32092 KB |
Output is correct |
17 |
Correct |
23 ms |
32048 KB |
Output is correct |
18 |
Correct |
20 ms |
32088 KB |
Output is correct |
19 |
Correct |
20 ms |
32088 KB |
Output is correct |
20 |
Correct |
21 ms |
32092 KB |
Output is correct |
21 |
Correct |
21 ms |
32092 KB |
Output is correct |
22 |
Correct |
22 ms |
32092 KB |
Output is correct |
23 |
Correct |
20 ms |
32088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
32092 KB |
Output is correct |
2 |
Correct |
6 ms |
31940 KB |
Output is correct |
3 |
Correct |
6 ms |
32092 KB |
Output is correct |
4 |
Correct |
6 ms |
32092 KB |
Output is correct |
5 |
Correct |
6 ms |
32092 KB |
Output is correct |
6 |
Correct |
6 ms |
32092 KB |
Output is correct |
7 |
Correct |
6 ms |
32088 KB |
Output is correct |
8 |
Correct |
11 ms |
31928 KB |
Output is correct |
9 |
Correct |
7 ms |
32092 KB |
Output is correct |
10 |
Correct |
6 ms |
32092 KB |
Output is correct |
11 |
Correct |
6 ms |
32092 KB |
Output is correct |
12 |
Correct |
6 ms |
32088 KB |
Output is correct |
13 |
Correct |
6 ms |
32092 KB |
Output is correct |
14 |
Correct |
6 ms |
31948 KB |
Output is correct |
15 |
Correct |
6 ms |
32092 KB |
Output is correct |
16 |
Correct |
6 ms |
32092 KB |
Output is correct |
17 |
Correct |
23 ms |
32048 KB |
Output is correct |
18 |
Correct |
20 ms |
32088 KB |
Output is correct |
19 |
Correct |
20 ms |
32088 KB |
Output is correct |
20 |
Correct |
21 ms |
32092 KB |
Output is correct |
21 |
Correct |
21 ms |
32092 KB |
Output is correct |
22 |
Correct |
22 ms |
32092 KB |
Output is correct |
23 |
Correct |
20 ms |
32088 KB |
Output is correct |
24 |
Runtime error |
2 ms |
856 KB |
Execution killed with signal 11 |
25 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
32092 KB |
Output is correct |
2 |
Correct |
6 ms |
31940 KB |
Output is correct |
3 |
Correct |
6 ms |
32092 KB |
Output is correct |
4 |
Correct |
6 ms |
32092 KB |
Output is correct |
5 |
Correct |
6 ms |
32092 KB |
Output is correct |
6 |
Correct |
6 ms |
32092 KB |
Output is correct |
7 |
Correct |
6 ms |
32088 KB |
Output is correct |
8 |
Correct |
11 ms |
31928 KB |
Output is correct |
9 |
Correct |
7 ms |
32092 KB |
Output is correct |
10 |
Correct |
6 ms |
32092 KB |
Output is correct |
11 |
Correct |
6 ms |
32092 KB |
Output is correct |
12 |
Correct |
6 ms |
32088 KB |
Output is correct |
13 |
Correct |
6 ms |
32092 KB |
Output is correct |
14 |
Correct |
6 ms |
31948 KB |
Output is correct |
15 |
Correct |
6 ms |
32092 KB |
Output is correct |
16 |
Correct |
6 ms |
32092 KB |
Output is correct |
17 |
Correct |
23 ms |
32048 KB |
Output is correct |
18 |
Correct |
20 ms |
32088 KB |
Output is correct |
19 |
Correct |
20 ms |
32088 KB |
Output is correct |
20 |
Correct |
21 ms |
32092 KB |
Output is correct |
21 |
Correct |
21 ms |
32092 KB |
Output is correct |
22 |
Correct |
22 ms |
32092 KB |
Output is correct |
23 |
Correct |
20 ms |
32088 KB |
Output is correct |
24 |
Runtime error |
2 ms |
856 KB |
Execution killed with signal 11 |
25 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
32092 KB |
Output is correct |
2 |
Correct |
6 ms |
31940 KB |
Output is correct |
3 |
Correct |
6 ms |
32092 KB |
Output is correct |
4 |
Correct |
6 ms |
32092 KB |
Output is correct |
5 |
Correct |
6 ms |
32092 KB |
Output is correct |
6 |
Correct |
6 ms |
32092 KB |
Output is correct |
7 |
Correct |
6 ms |
32088 KB |
Output is correct |
8 |
Correct |
11 ms |
31928 KB |
Output is correct |
9 |
Correct |
7 ms |
32092 KB |
Output is correct |
10 |
Correct |
6 ms |
32092 KB |
Output is correct |
11 |
Correct |
6 ms |
32092 KB |
Output is correct |
12 |
Correct |
6 ms |
32088 KB |
Output is correct |
13 |
Correct |
6 ms |
32092 KB |
Output is correct |
14 |
Correct |
6 ms |
31948 KB |
Output is correct |
15 |
Correct |
6 ms |
32092 KB |
Output is correct |
16 |
Correct |
6 ms |
32092 KB |
Output is correct |
17 |
Correct |
23 ms |
32048 KB |
Output is correct |
18 |
Correct |
20 ms |
32088 KB |
Output is correct |
19 |
Correct |
20 ms |
32088 KB |
Output is correct |
20 |
Correct |
21 ms |
32092 KB |
Output is correct |
21 |
Correct |
21 ms |
32092 KB |
Output is correct |
22 |
Correct |
22 ms |
32092 KB |
Output is correct |
23 |
Correct |
20 ms |
32088 KB |
Output is correct |
24 |
Runtime error |
2 ms |
856 KB |
Execution killed with signal 11 |
25 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
856 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
856 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |