#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int>vi;
#define pb push_back
#define sz(v) (int)v.size()
typedef pair<int,int>pi;
#define fi first
#define se second
typedef vector<pi>vpi;
#define eb emplace_back
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=b-1; i>=a; i--)
void ckmax(int &x, int y){x=max(x,y);}
void ckmin(int &x, int y){x=min(x,y);}
const int MX=1e5+10;
//-----------------------------
int N,M,R[5000][200],D[5000][200];
void init(int N, int M, int H[5000][200], int V[5000][200]) {
::N=N; ::M=M;
FOR(i,0,N) FOR(j,0,M){
R[i][j]=H[i][j];
D[i][j]=V[i][j];
}
}
void changeH(int x, int y, int w) {
R[x][y]=w;
}
void changeV(int x, int y, int w) {
D[x][y]=w;
}
int get(int x, int l, int r){
if(l>r) swap(l,r);
int ans=0;
FOR(i,l,r) ans+=R[x][i];
return ans;
}
int escape(int V1, int V2) {
int dp[N][M];
FOR(j,0,M) dp[0][j]=get(0,V1,j);
FOR(i,1,N) FOR(j,0,M){
dp[i][j]=2e9;
FOR(k,0,M){
int x=get(i,j,k)+dp[i-1][k]+D[i-1][k];
ckmin(dp[i][j],x);
}
}
return dp[N-1][V2];
}
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 |
Correct |
19 ms |
11980 KB |
Output is correct |
2 |
Correct |
19 ms |
11980 KB |
Output is correct |
3 |
Correct |
4843 ms |
14748 KB |
Output is correct |
4 |
Correct |
20 ms |
12032 KB |
Output is correct |
5 |
Correct |
20 ms |
12088 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
25 ms |
372 KB |
Output is correct |
5 |
Correct |
26 ms |
332 KB |
Output is correct |
6 |
Correct |
25 ms |
388 KB |
Output is correct |
7 |
Correct |
24 ms |
332 KB |
Output is correct |
8 |
Correct |
19 ms |
392 KB |
Output is correct |
9 |
Correct |
24 ms |
332 KB |
Output is correct |
10 |
Correct |
20 ms |
332 KB |
Output is correct |
11 |
Correct |
12068 ms |
2664 KB |
Output is correct |
12 |
Correct |
25 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2728 ms |
664 KB |
Output is correct |
2 |
Correct |
2711 ms |
836 KB |
Output is correct |
3 |
Correct |
2774 ms |
836 KB |
Output is correct |
4 |
Correct |
2749 ms |
728 KB |
Output is correct |
5 |
Correct |
2660 ms |
728 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
2752 ms |
720 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
69 ms |
15980 KB |
Output is correct |
2 |
Correct |
76 ms |
15948 KB |
Output is correct |
3 |
Correct |
78 ms |
15948 KB |
Output is correct |
4 |
Correct |
6575 ms |
17652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2711 ms |
644 KB |
Output is correct |
2 |
Correct |
2657 ms |
716 KB |
Output is correct |
3 |
Correct |
2751 ms |
724 KB |
Output is correct |
4 |
Correct |
2759 ms |
744 KB |
Output is correct |
5 |
Correct |
2669 ms |
744 KB |
Output is correct |
6 |
Correct |
80 ms |
15948 KB |
Output is correct |
7 |
Correct |
77 ms |
15932 KB |
Output is correct |
8 |
Correct |
74 ms |
15936 KB |
Output is correct |
9 |
Correct |
6709 ms |
17468 KB |
Output is correct |
10 |
Correct |
20 ms |
11980 KB |
Output is correct |
11 |
Correct |
21 ms |
11980 KB |
Output is correct |
12 |
Correct |
4781 ms |
14908 KB |
Output is correct |
13 |
Correct |
20 ms |
11980 KB |
Output is correct |
14 |
Correct |
20 ms |
11980 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
25 ms |
332 KB |
Output is correct |
19 |
Correct |
25 ms |
332 KB |
Output is correct |
20 |
Correct |
25 ms |
332 KB |
Output is correct |
21 |
Correct |
25 ms |
332 KB |
Output is correct |
22 |
Correct |
19 ms |
332 KB |
Output is correct |
23 |
Correct |
24 ms |
332 KB |
Output is correct |
24 |
Correct |
21 ms |
428 KB |
Output is correct |
25 |
Correct |
12719 ms |
2732 KB |
Output is correct |
26 |
Correct |
25 ms |
332 KB |
Output is correct |
27 |
Correct |
2758 ms |
720 KB |
Output is correct |
28 |
Execution timed out |
20043 ms |
21440 KB |
Time limit exceeded |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2776 ms |
648 KB |
Output is correct |
2 |
Correct |
2636 ms |
836 KB |
Output is correct |
3 |
Correct |
2753 ms |
840 KB |
Output is correct |
4 |
Correct |
2777 ms |
836 KB |
Output is correct |
5 |
Correct |
2735 ms |
728 KB |
Output is correct |
6 |
Correct |
79 ms |
15948 KB |
Output is correct |
7 |
Correct |
72 ms |
16016 KB |
Output is correct |
8 |
Correct |
71 ms |
16040 KB |
Output is correct |
9 |
Correct |
6054 ms |
17372 KB |
Output is correct |
10 |
Correct |
19 ms |
11980 KB |
Output is correct |
11 |
Correct |
20 ms |
12048 KB |
Output is correct |
12 |
Correct |
4795 ms |
15056 KB |
Output is correct |
13 |
Correct |
20 ms |
11980 KB |
Output is correct |
14 |
Correct |
20 ms |
12084 KB |
Output is correct |
15 |
Execution timed out |
20064 ms |
29572 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |