# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
776405 |
2023-07-07T20:12:28 Z |
tolbi |
Wombats (IOI13_wombats) |
C++17 |
|
20000 ms |
262144 KB |
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
#define author tolbi
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define rev(x) reverse(x.begin(), x.end())
#define tol(bi) (1LL<<((int)(bi)))
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
const int MOD = 1e9+7;
const int INF = MOD;
#include "wombats.h"
int h[5000][200];
int v[5000][200];
int n,m;
vector<vector<vector<int>>> dp;
void calc(int las){
dp[las][n-1][las]=0;
for (int i = n-1; i >= 0; i--){
if (i<n-1){
for (int j = 0; j < m; ++j)
{
dp[las][i][j]=dp[las][i+1][j]+v[i][j];
}
}
for (int j = 1; j < m; j++){
dp[las][i][j]=min(dp[las][i][j],dp[las][i][j-1]+h[i][j-1]);
}
for (int j = m-2; j >= 0; j--){
dp[las][i][j]=min(dp[las][i][j],dp[las][i][j+1]+h[i][j]);
}
}
}
void init(int R, int C, int H[5000][200], int V[5000][200]) {
for (int i = 0; i < R; i++){
for (int j = 0; j < C; j++){
h[i][j]=H[i][j];
v[i][j]=V[i][j];
}
}
n=R,m=C;
dp.resize(m,vector<vector<int>>(n,vector<int>(m,INF)));
}
void changeH(int P, int Q, int W){
h[P][Q]=W;
dp.clear();
dp.resize(m,vector<vector<int>>(n,vector<int>(m,INF)));
}
void changeV(int P, int Q, int W) {
v[P][Q]=W;
dp.clear();
dp.resize(m,vector<vector<int>>(n,vector<int>(m,INF)));
}
int escape(int V1, int V2) {
if (dp[V2][0][V1]==INF) calc(V2);
return dp[V2][0][V1];
}
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;
| ^~~
wombats.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
1 | #pragma optimize("Bismillahirrahmanirrahim")
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
281 ms |
12880 KB |
Output is correct |
2 |
Correct |
285 ms |
13316 KB |
Output is correct |
3 |
Correct |
338 ms |
14356 KB |
Output is correct |
4 |
Correct |
283 ms |
13220 KB |
Output is correct |
5 |
Correct |
280 ms |
12884 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
53 ms |
1396 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
134 ms |
5208 KB |
Output is correct |
2 |
Correct |
133 ms |
5152 KB |
Output is correct |
3 |
Correct |
140 ms |
5324 KB |
Output is correct |
4 |
Correct |
139 ms |
5216 KB |
Output is correct |
5 |
Correct |
141 ms |
5228 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
644 ms |
5320 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
424 ms |
17056 KB |
Output is correct |
2 |
Correct |
428 ms |
17044 KB |
Output is correct |
3 |
Correct |
429 ms |
17184 KB |
Output is correct |
4 |
Correct |
451 ms |
17828 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
5432 KB |
Output is correct |
2 |
Correct |
134 ms |
5160 KB |
Output is correct |
3 |
Correct |
138 ms |
5204 KB |
Output is correct |
4 |
Correct |
137 ms |
5184 KB |
Output is correct |
5 |
Correct |
157 ms |
5216 KB |
Output is correct |
6 |
Correct |
424 ms |
17044 KB |
Output is correct |
7 |
Correct |
427 ms |
17152 KB |
Output is correct |
8 |
Correct |
426 ms |
17148 KB |
Output is correct |
9 |
Correct |
463 ms |
18040 KB |
Output is correct |
10 |
Correct |
286 ms |
12868 KB |
Output is correct |
11 |
Correct |
286 ms |
12988 KB |
Output is correct |
12 |
Correct |
330 ms |
14444 KB |
Output is correct |
13 |
Correct |
279 ms |
12868 KB |
Output is correct |
14 |
Correct |
294 ms |
13004 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
392 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
55 ms |
1436 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
640 ms |
5228 KB |
Output is correct |
28 |
Execution timed out |
20013 ms |
235604 KB |
Time limit exceeded |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
5300 KB |
Output is correct |
2 |
Correct |
134 ms |
5112 KB |
Output is correct |
3 |
Correct |
138 ms |
5184 KB |
Output is correct |
4 |
Correct |
138 ms |
5204 KB |
Output is correct |
5 |
Correct |
136 ms |
5196 KB |
Output is correct |
6 |
Correct |
421 ms |
17184 KB |
Output is correct |
7 |
Correct |
428 ms |
17052 KB |
Output is correct |
8 |
Correct |
424 ms |
17044 KB |
Output is correct |
9 |
Correct |
457 ms |
17916 KB |
Output is correct |
10 |
Correct |
277 ms |
12876 KB |
Output is correct |
11 |
Correct |
280 ms |
12868 KB |
Output is correct |
12 |
Correct |
334 ms |
14436 KB |
Output is correct |
13 |
Correct |
308 ms |
12868 KB |
Output is correct |
14 |
Correct |
287 ms |
13196 KB |
Output is correct |
15 |
Runtime error |
216 ms |
262144 KB |
Execution killed with signal 9 |
16 |
Halted |
0 ms |
0 KB |
- |