답안 #776409

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
776409 2023-07-07T20:19:54 Z tolbi 웜뱃 (IOI13_wombats) C++17
55 / 100
20000 ms 211660 KB
#pragma optimize("Bismillahirrahmanirrahim")
#pragma GCC optimize("Ofast")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//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")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 13908 KB Output is correct
2 Correct 16 ms 14020 KB Output is correct
3 Correct 69 ms 15532 KB Output is correct
4 Correct 22 ms 13932 KB Output is correct
5 Correct 16 ms 14020 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 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 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 55 ms 1652 KB Output is correct
12 Correct 1 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 3156 KB Output is correct
2 Correct 16 ms 3464 KB Output is correct
3 Correct 16 ms 3596 KB Output is correct
4 Correct 16 ms 3564 KB Output is correct
5 Correct 16 ms 3796 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 340 KB Output is correct
9 Correct 9 ms 724 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 19860 KB Output is correct
2 Correct 94 ms 19796 KB Output is correct
3 Correct 95 ms 19796 KB Output is correct
4 Correct 123 ms 20640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 3156 KB Output is correct
2 Correct 16 ms 3404 KB Output is correct
3 Correct 16 ms 3556 KB Output is correct
4 Correct 17 ms 3540 KB Output is correct
5 Correct 16 ms 3760 KB Output is correct
6 Correct 94 ms 19796 KB Output is correct
7 Correct 96 ms 19872 KB Output is correct
8 Correct 94 ms 19796 KB Output is correct
9 Correct 123 ms 20592 KB Output is correct
10 Correct 16 ms 13908 KB Output is correct
11 Correct 16 ms 14020 KB Output is correct
12 Correct 69 ms 15572 KB Output is correct
13 Correct 16 ms 13908 KB Output is correct
14 Correct 16 ms 14016 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 59 ms 1568 KB Output is correct
26 Correct 1 ms 596 KB Output is correct
27 Correct 9 ms 744 KB Output is correct
28 Execution timed out 20108 ms 211660 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 3156 KB Output is correct
2 Correct 16 ms 3396 KB Output is correct
3 Correct 17 ms 3540 KB Output is correct
4 Correct 16 ms 3524 KB Output is correct
5 Correct 16 ms 3732 KB Output is correct
6 Correct 97 ms 19864 KB Output is correct
7 Correct 94 ms 19868 KB Output is correct
8 Correct 94 ms 19796 KB Output is correct
9 Correct 125 ms 20692 KB Output is correct
10 Correct 18 ms 14020 KB Output is correct
11 Correct 16 ms 14020 KB Output is correct
12 Correct 71 ms 15572 KB Output is correct
13 Correct 17 ms 13908 KB Output is correct
14 Correct 17 ms 14016 KB Output is correct
15 Runtime error 144 ms 32104 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -