# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
596024 |
2022-07-14T09:21:53 Z |
이동현(#8445) |
Bodyguard (JOI21_bodyguard) |
C++17 |
|
2484 ms |
881800 KB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
int sum[12004][6004][2];
int dp[12004][6004];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, q; cin >> n >> q;
for(int i = 0; i < n; ++i){
int t, a, b, c; cin >> t >> a >> b >> c;
t *= 2;
c /= 2;
a *= 2, b *= 2;
int pos = a, now = t;
while(pos != b){
if(a < b){
sum[pos][now][1] = max(sum[pos][now][1], c);
++pos; ++now;
}
else{
sum[pos][now][0] = max(sum[pos][now][0], c);
--pos; ++now;
}
}
}
for(int j = 6002; j >= 0; --j){
for(int i = 0; i < 6004; ++i){
dp[i][j] = dp[i][j + 1];
if(i + 1 < 6004) dp[i][j] = max(dp[i][j], dp[i + 1][j + 1] + sum[i][j][1]);
if(i) dp[i][j] = max(dp[i][j], dp[i - 1][j + 1] + sum[i][j][0]);
}
}
while(q--){
int x, t; cin >> t >> x; x *= 2; t *= 2;
cout << dp[x][t] << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2484 ms |
881800 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2484 ms |
881800 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |