답안 #776388

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
776388 2023-07-07T19:36:00 Z tolbi 웜뱃 (IOI13_wombats) C++17
39 / 100
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 = 1e18;

#include "wombats.h"

int h[5000][200];
int v[5000][200];
int n,m;
vector<vector<vector<int>>> dp;

void calc(int las){
	priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>> pq;
	pq.push({0,{n-1,las}});
	while (pq.size()){
		int x = pq.top().second.first;
		int y = pq.top().second.second;
		int w = pq.top().first;
		pq.pop();
		if (dp[las][x][y]!=-1) continue;
		dp[las][x][y]=w;
		if (x>0 && dp[las][x-1][y]==-1){
			pq.push({w+v[x-1][y],{x-1,y}});
		}
		if (y>0 && dp[las][x][y-1]==-1){
			pq.push({w+h[x][y-1],{x,y-1}});
		}
		if (y<m-1 && dp[las][x][y+1]==-1){
			pq.push({w+h[x][y],{x,y+1}});
		}
	}
}
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,-1)));
	for (int i = 0; i < m; ++i)
	{
		calc(i);
	}
}

void changeH(int P, int Q, int W){
	h[P][Q]=W;
	dp.clear();
	dp.resize(m,vector<vector<int>>(n,vector<int>(m,-1)));
	for (int i = 0; i < m; ++i)
	{
		calc(i);
	}
}
void changeV(int P, int Q, int W) {
	v[P][Q]=W;
	dp.clear();
	dp.resize(m,vector<vector<int>>(n,vector<int>(m,-1)));
	for (int i = 0; i < m; ++i)
	{
		calc(i);
	}
}
int escape(int V1, int 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")
      | 
wombats.cpp:22:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   22 | const int INF = 1e18;
      |                 ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 312 ms 13028 KB Output is correct
2 Correct 309 ms 12912 KB Output is correct
3 Correct 366 ms 15548 KB Output is correct
4 Correct 314 ms 12916 KB Output is correct
5 Correct 313 ms 12916 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 57 ms 2916 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16018 ms 5300 KB Output is correct
2 Correct 19294 ms 5144 KB Output is correct
3 Correct 16105 ms 5100 KB Output is correct
4 Correct 15891 ms 5020 KB Output is correct
5 Correct 15597 ms 5008 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Execution timed out 20050 ms 5048 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 858 ms 17164 KB Output is correct
2 Correct 1435 ms 17304 KB Output is correct
3 Correct 879 ms 17132 KB Output is correct
4 Correct 925 ms 18000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15702 ms 5080 KB Output is correct
2 Correct 18900 ms 5100 KB Output is correct
3 Correct 15893 ms 5064 KB Output is correct
4 Correct 15774 ms 5072 KB Output is correct
5 Correct 15388 ms 5152 KB Output is correct
6 Correct 875 ms 17084 KB Output is correct
7 Correct 1371 ms 17192 KB Output is correct
8 Correct 918 ms 17084 KB Output is correct
9 Correct 898 ms 17800 KB Output is correct
10 Correct 338 ms 12868 KB Output is correct
11 Correct 326 ms 12880 KB Output is correct
12 Correct 381 ms 14356 KB Output is correct
13 Correct 312 ms 13124 KB Output is correct
14 Correct 306 ms 12876 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 2 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 2 ms 444 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 416 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 76 ms 1416 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Execution timed out 20025 ms 5108 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15412 ms 5012 KB Output is correct
2 Correct 18917 ms 5188 KB Output is correct
3 Correct 15691 ms 5108 KB Output is correct
4 Correct 15732 ms 5160 KB Output is correct
5 Correct 15362 ms 5092 KB Output is correct
6 Correct 875 ms 17120 KB Output is correct
7 Correct 1356 ms 17128 KB Output is correct
8 Correct 863 ms 17332 KB Output is correct
9 Correct 902 ms 18000 KB Output is correct
10 Correct 319 ms 12888 KB Output is correct
11 Correct 306 ms 12876 KB Output is correct
12 Correct 358 ms 14432 KB Output is correct
13 Correct 304 ms 12880 KB Output is correct
14 Correct 306 ms 13092 KB Output is correct
15 Runtime error 231 ms 262144 KB Execution killed with signal 9
16 Halted 0 ms 0 KB -