Submission #776392

# Submission time Handle Problem Language Result Execution time Memory
776392 2023-07-07T19:45:50 Z tolbi Wombats (IOI13_wombats) C++17
55 / 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)));
}

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)));
}
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)));
}
int escape(int V1, int V2) {
	if (dp[V2][0][V1]==-1) 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")
      | 
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;
      |                 ^~~~
# Verdict Execution time Memory Grader output
1 Correct 303 ms 12868 KB Output is correct
2 Correct 303 ms 12880 KB Output is correct
3 Correct 372 ms 14436 KB Output is correct
4 Correct 318 ms 12880 KB Output is correct
5 Correct 305 ms 12868 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 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 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 70 ms 1380 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 235 ms 5344 KB Output is correct
2 Correct 329 ms 5148 KB Output is correct
3 Correct 302 ms 5112 KB Output is correct
4 Correct 310 ms 5092 KB Output is correct
5 Correct 294 ms 5080 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 731 ms 5256 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 886 ms 17196 KB Output is correct
2 Correct 1344 ms 17100 KB Output is correct
3 Correct 866 ms 17080 KB Output is correct
4 Correct 914 ms 17932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 229 ms 5172 KB Output is correct
2 Correct 318 ms 5156 KB Output is correct
3 Correct 294 ms 5128 KB Output is correct
4 Correct 288 ms 5124 KB Output is correct
5 Correct 295 ms 5068 KB Output is correct
6 Correct 861 ms 17124 KB Output is correct
7 Correct 1385 ms 17172 KB Output is correct
8 Correct 902 ms 17204 KB Output is correct
9 Correct 943 ms 17836 KB Output is correct
10 Correct 341 ms 12868 KB Output is correct
11 Correct 313 ms 12928 KB Output is correct
12 Correct 362 ms 14368 KB Output is correct
13 Correct 310 ms 13160 KB Output is correct
14 Correct 313 ms 12884 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 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 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 57 ms 1416 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 736 ms 5260 KB Output is correct
28 Execution timed out 20059 ms 239100 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 222 ms 5336 KB Output is correct
2 Correct 347 ms 5228 KB Output is correct
3 Correct 304 ms 5168 KB Output is correct
4 Correct 289 ms 5180 KB Output is correct
5 Correct 306 ms 5108 KB Output is correct
6 Correct 915 ms 17120 KB Output is correct
7 Correct 1405 ms 17256 KB Output is correct
8 Correct 857 ms 17288 KB Output is correct
9 Correct 933 ms 18156 KB Output is correct
10 Correct 325 ms 12884 KB Output is correct
11 Correct 303 ms 12904 KB Output is correct
12 Correct 379 ms 14684 KB Output is correct
13 Correct 317 ms 13240 KB Output is correct
14 Correct 374 ms 12904 KB Output is correct
15 Runtime error 229 ms 262144 KB Execution killed with signal 9
16 Halted 0 ms 0 KB -