답안 #235243

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
235243 2020-05-27T13:37:12 Z crossing0ver 웜뱃 (IOI13_wombats) C++17
컴파일 오류
0 ms 0 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,i,j;
pair<int,pair<int,int> > v;
bool flag,tr[5000][200];
int D[200][200];
int dx[] = {0,0,1};
int dy[] = {1,-1,0};
priority_queue<pair<int,pair<int,int > > > pq; 
void dijkstra() {
	for (i = 0; i < C; i++) {
		help++;
		pq.push ({0,{0, i}});
		tr[0][i] = help;
		while (!pq.empty()) {
			 v = pq.top();
			 pq.pop();
			 X = v.se.fi;
			 Y = v.se.se;
			 if (vis[X][Y] == help) continue; 
			 val = -v.fi;
			vis[X][Y] = help;
			for (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} } );
				}
			}
		}
		for (j = 0; j < C; j++)
			D[i][j] = dis[R-1][j];
	}
}
void init(int R1, int C1, int H1[5000][200], int V1[5000][200]) {
	R = R1; C = C1;
	for (i = 0; i < R; i++)
	for (j = 0; j < C; j++) {
		H[i][j] = H1[i][j],
		V[i][j] = V1[i][j];
	}
	for (i = 0; i < R; i++)
	for (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];
	}
}
void changeH(int P, int Q, int W) {
	G[P][Q][0] = W;
	G[P][Q+1][1] = W;
flag = 0;
}
void changeV(int P, int Q, int W) {
    G[P][Q][2] = W;
flag = 0;
}
int escape(int V1, int V2) {
	if (!flag) {
		flag = 1;
		dijkstra();
	}
    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;
      ^~~
wombats.cpp:8:23: error: conflicting declaration 'bool tr [5000][200]'
 bool flag,tr[5000][200];
                       ^
wombats.cpp:6:95: note: previous declaration as 'int tr [5000][200]'
 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,i,j;
                                                                                               ^~