///~~~LOTA~~~///
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define N 10000000
int n,m;
int x[5000][200];
int y[5000][200];
int dp[5000][200][200];
void compute_dp(){
for(int i=0;i<m;i++)
for(int j=0;j<m;j++)
dp[n-1][i][j]=abs(x[n-1][i]-x[n-1][j]);
for(int i=n-2;i>=0;i--){
for(int j=0;j<m;j++){
for(int k=0;k<m;k++){
dp[i][j][k]=1e9;
for(int l=0;l<m;l++)
dp[i][j][k]=min(dp[i][j][k],
dp[i+1][l][k]+abs(x[i][j]-x[i][l])+y[i][l]);
}
}
}
}
void init(int R, int C, int H[5000][200], int V[5000][200]){
n=R; m=C;
for(int i=0;i<n;i++)
for(int j=0;j<m-1;j++)
x[i][j+1]=x[i][j]+H[i][j];
for(int i=0;i<n-1;i++)
for(int j=0;j<n;j++)
y[i][j]=V[i][j];
compute_dp();
}
void changeV(int p,int q,int w){
}
void changeH(int p,int q,int w){
}
int escape(int p,int q){
return dp[0][p][q];
}
Compilation message
grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
15 | int res;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
63 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4600 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
2 ms |
4444 KB |
Output is correct |
4 |
Correct |
2 ms |
10584 KB |
Output is correct |
5 |
Correct |
2 ms |
10584 KB |
Output is correct |
6 |
Correct |
2 ms |
10588 KB |
Output is correct |
7 |
Correct |
2 ms |
10588 KB |
Output is correct |
8 |
Correct |
2 ms |
10588 KB |
Output is correct |
9 |
Incorrect |
2 ms |
10588 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
131 ms |
23124 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
42 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
134 ms |
23124 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
146 ms |
23124 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |