답안 #235239

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
235239 2020-05-27T13:15:39 Z crossing0ver 웜뱃 (IOI13_wombats) C++17
12 / 100
20000 ms 56248 KB
#include<bits/stdc++.h>
#define fi first
#define se second
#include "wombats.h"
using namespace std;
int R,C,H[5000][200],V[5000][200],vis[5000][200],help,dis[5000][2000],X,Y,x,y,G[5000][200][3],tr[5000][200],val;
int D[200][200];
int dx[] = {0,0,1};
int dy[] = {1,-1,0};
priority_queue<pair<int,pair<int,int > > > pq; 
void dijkstra() {
	while (!pq.empty())
	pq.pop();
	for (int i = 0; i < C; i++) {
		help++;
		pq.push ({0,{0, i}});
		tr[0][i] = help;
		while (!pq.empty()) {
			auto v = pq.top();
			val = -v.fi;
			 X = v.se.fi;
			 Y = v.se.se;
			pq.pop();
			if (vis[X][Y] == help) continue;
			vis[X][Y] = help;
			if (X == R - 1) {
				D[i][Y] = val;
			}
			for (int j = 0; j < 3; j++) {
				x = dx[j] +	X;
				y = dy[j] + Y;
				if (X >= R || Y < 0 || Y >= C) continue;
				if (help != tr[x][y] || dis[x][y] > val + G[X][Y][j] ) {
					tr[x][y] = help;
					dis[x][y] = val + G[X][Y][j];
					pq.push( { -dis[x][y], { x , y} } );
				}
			}
		}
	}
}
void init(int R1, int C1, int H1[5000][200], int V1[5000][200]) {
	R = R1; C = C1;
	for (int i = 0; i < R; i++)
	for (int j = 0; j < C; j++) {
		H[i][j] = H1[i][j],
		V[i][j] = V1[i][j];
	}
	for (int i = 0; i < R; i++)
	for (int j = 0; j < C; j++) {
		G[i][j][0] = H[i][j];
		if (j)
		G[i][j][1] = H[i][j-1];
		G[i][j][2] = V[i][j];
	}
	dijkstra();
}
void changeH(int P, int Q, int W) {
	G[P][Q][0] = W;
	G[P][Q+1][1] = W;
	dijkstra();
}

void changeV(int P, int Q, int W) {
    G[P][Q][2] = W;
    dijkstra();
}

int escape(int V1, int V2) {
    return D[V1][V2];
}

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 731 ms 52032 KB Output is correct
2 Correct 408 ms 51704 KB Output is correct
3 Incorrect 490 ms 54564 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 640 KB Output is correct
5 Correct 5 ms 640 KB Output is correct
6 Correct 7 ms 640 KB Output is correct
7 Correct 7 ms 640 KB Output is correct
8 Correct 6 ms 640 KB Output is correct
9 Correct 6 ms 640 KB Output is correct
10 Correct 6 ms 640 KB Output is correct
11 Correct 92 ms 2940 KB Output is correct
12 Correct 7 ms 660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16271 ms 1656 KB Output is correct
2 Execution timed out 20033 ms 1792 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1291 ms 55704 KB Output is correct
2 Execution timed out 20080 ms 56248 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16221 ms 1784 KB Output is correct
2 Execution timed out 20025 ms 1792 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16274 ms 1644 KB Output is correct
2 Execution timed out 20023 ms 1784 KB Time limit exceeded
3 Halted 0 ms 0 KB -