Submission #776410

# Submission time Handle Problem Language Result Execution time Memory
776410 2023-07-07T20:21:32 Z tolbi Wombats (IOI13_wombats) C++17
55 / 100
20000 ms 211644 KB
#pragma optimize("Bismillahirrahmanirrahim")
#pragma GCC optimize("O3,unroll-loops,Ofast")
#pragma GCC target("avx2")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//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;
int dp[100][5000][100];
vector<bool> res;

inline void calc(int las){
	dp[las][n-1][las]=0;
	res[las]=true;
	for (int i = las+1; i < m; i++){
		dp[las][n-1][i]=dp[las][n-1][i-1]+h[n-1][i-1];
	}
	for (int i = las-1; i >= 0; i--){
		dp[las][n-1][i]=dp[las][n-1][i+1]+h[n-1][i];
	}
	for (int i = n-2; i >= 0; i--){
		for (int j = 0; j < m; ++j)
		{
			dp[las][i][j]=dp[las][i+1][j]+v[i][j];
			if (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;
	res.resize(m,false);
	fill(res.begin(), res.end(), false);
}

void changeH(int P, int Q, int W){
	h[P][Q]=W;
	fill(res.begin(), res.end(), false);
}
void changeV(int P, int Q, int W) {
	v[P][Q]=W;
	fill(res.begin(), res.end(), false);
}
int escape(int V1, int V2) {
	if (res[V2]==false) 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 15 ms 13908 KB Output is correct
2 Correct 16 ms 14016 KB Output is correct
3 Correct 70 ms 15536 KB Output is correct
4 Correct 16 ms 13908 KB Output is correct
5 Correct 17 ms 14012 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 56 ms 1664 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 3156 KB Output is correct
2 Correct 16 ms 3412 KB Output is correct
3 Correct 16 ms 3540 KB Output is correct
4 Correct 16 ms 3664 KB Output is correct
5 Correct 16 ms 3796 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 10 ms 724 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 95 ms 19860 KB Output is correct
2 Correct 92 ms 19796 KB Output is correct
3 Correct 94 ms 19864 KB Output is correct
4 Correct 125 ms 20580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 3228 KB Output is correct
2 Correct 16 ms 3492 KB Output is correct
3 Correct 16 ms 3592 KB Output is correct
4 Correct 17 ms 3540 KB Output is correct
5 Correct 17 ms 3696 KB Output is correct
6 Correct 93 ms 19860 KB Output is correct
7 Correct 93 ms 19796 KB Output is correct
8 Correct 93 ms 19864 KB Output is correct
9 Correct 122 ms 20636 KB Output is correct
10 Correct 16 ms 13908 KB Output is correct
11 Correct 17 ms 14020 KB Output is correct
12 Correct 70 ms 15528 KB Output is correct
13 Correct 17 ms 14020 KB Output is correct
14 Correct 17 ms 14020 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 1 ms 596 KB Output is correct
19 Correct 1 ms 596 KB Output is correct
20 Correct 1 ms 596 KB Output is correct
21 Correct 1 ms 596 KB Output is correct
22 Correct 1 ms 596 KB Output is correct
23 Correct 1 ms 596 KB Output is correct
24 Correct 1 ms 596 KB Output is correct
25 Correct 56 ms 1600 KB Output is correct
26 Correct 1 ms 596 KB Output is correct
27 Correct 8 ms 724 KB Output is correct
28 Execution timed out 20106 ms 211644 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 3180 KB Output is correct
2 Correct 16 ms 3432 KB Output is correct
3 Correct 16 ms 3536 KB Output is correct
4 Correct 16 ms 3540 KB Output is correct
5 Correct 16 ms 3752 KB Output is correct
6 Correct 93 ms 19796 KB Output is correct
7 Correct 95 ms 19984 KB Output is correct
8 Correct 93 ms 19796 KB Output is correct
9 Correct 123 ms 20636 KB Output is correct
10 Correct 16 ms 13908 KB Output is correct
11 Correct 16 ms 14016 KB Output is correct
12 Correct 71 ms 15564 KB Output is correct
13 Correct 16 ms 14016 KB Output is correct
14 Correct 16 ms 14024 KB Output is correct
15 Runtime error 148 ms 32068 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -