Submission #31954

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
319542017-09-18 15:09:16minhtung0404도장 모으기 (JOI14_stamps)C++14
85 / 100
66 ms72748 KiB
#include<bits/stdc++.h>
const long long N = 3005;
const long long inf = 1e9;
using namespace std;
long long n, t, u[N][2], d[N][2];
long long l[N][2], r[N][2], dp[N][N];
int main(){
scanf("%lld %lld", &n, &t);
for (long long i = 1; i <= n; i++) scanf("%lld %lld %lld %lld", &u[i][0], &u[i][1], &d[i][0], &d[i][1]);
for (long long i = 1; i <= n; i++){
r[i][0] = u[i][1]; l[i][0] = u[i][0];
r[i][1] = d[i][1]; l[i][1] = d[i][0];
for (long long j = 1; j < i; j++){
r[i][0] = min(r[i][0], d[i][1]+2*t*(i-j)+d[j][0]+u[j][1]);
l[i][1] = min(l[i][1], 2*t*(i-j)+d[j][0]+u[j][1]+u[j][0]);
}
for (long long j = i+1; j <= n; j++){
r[i][1] = min(r[i][1], u[i][1]+2*t*(j-i)+u[j][0]+d[j][1]);
l[i][0] = min(l[i][0], 2*t*(j-i)+u[j][0]+d[j][1]+d[j][0]);
}
r[i][0] -= t*i; l[i][0] += t*i;
r[i][1] += t*i; l[i][1] -= t*i;
}
for (long long i = 0; i <= n; i++) for (long long j = 0; j <= n; j++) dp[i][j] = inf;
dp[0][1] = 0;
for (long long i = 0; i < n; i++){
for (long long j = 0; j <= n; j++){
if (dp[i][j] == inf) continue;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

stamps.cpp: In function 'int main()':
stamps.cpp:10:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld", &n, &t);
                               ^
stamps.cpp:11:108: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (long long i = 1; i <= n; i++) scanf("%lld %lld %lld %lld", &u[i][0], &u[i][1], &d[i][0], &d[i][1]);
                                                                                                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...