제출 #125835

#제출 시각아이디문제언어결과실행 시간메모리
125835MoNsTeR_CuBe웜뱃 (IOI13_wombats)C++17
9 / 100
20033 ms262148 KiB
#include "wombats.h" #include <bits/stdc++.h> using namespace std; int row, col; int sum = 0; int h[5000][200]; int v[5000][200]; const int INF = INT_MAX; vector< vector< int > > Graph; void init(int R, int C, int H[5000][200], int V[5000][200]) { row = R; col = C; for(int i = 0; i < 5000; i++){ for(int j = 0; j < 200; j++){ h[i][j] = H[i][j]; v[i][j] = V[i][j]; } } if(C == 1){ for(int i = 0; i < row-1; i++){ sum += V[i][0]; } return; } Graph.resize(R*C, vector< int > (R*C, -1)); for(int i = 0; i < R; i++){ for(int j = 0; j < C-1; j++){ Graph[i*C+j][i*C+j+1] = H[i][j]; Graph[i*C+j+1][i*C+j] = H[i][j]; } } for(int i = 0; i < R-1; i++){ for(int j = 0; j < C; j++){ Graph[i*C+j][(i+1)*C+j] = V[i][j]; } } } void changeH(int P, int Q, int W) { if(col == 1){ sum += W - h[P][Q]; h[P][Q] = W; return; } Graph[P*col+Q][P*col+Q+1] = W; Graph[P*col+Q+1][P*col+Q] = W; } void changeV(int P, int Q, int W) { if(col == 1){ sum += W - v[P][Q]; v[P][Q] = W; return; } Graph[P*col+Q][(P+1)*col+Q] = W; } int escape(int V1, int V2) { if(col == 1){ return sum; } priority_queue< pair<int, int>, vector< pair<int, int> >, greater< pair<int, int> > > pq; vector< int > dist(row*col, INF); dist[V1] = 0; pq.push(make_pair(0,V1)); while(!pq.empty()){ int node = pq.top().second; int cost = pq.top().first; pq.pop(); //cout << node << ' ' << cost << endl; if(dist[node] != cost) continue; for(int i = 0; i < row*col; i++){ if(Graph[node][i] != -1){ if(dist[i] > cost + Graph[node][i]){ dist[i] = cost+Graph[node][i]; pq.push(make_pair(dist[i], i)); } } } } return dist[(row-1)*col+V2]; }

컴파일 시 표준 에러 (stderr) 메시지

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...