Submission #586679

#TimeUsernameProblemLanguageResultExecution timeMemory
586679AlperenTWombats (IOI13_wombats)C++17
39 / 100
20035 ms262144 KiB
#include <bits/stdc++.h> #include "wombats.h" using namespace std; const int N = 5000 + 1, M = 100, INF = 1e9 + 5; int n, m, h[N][M], v[N][M], dist[M][N][M]; void calc_dist(){ for(int lst = 0; lst < m; lst++){ for(int c = 0; c < m; c++) dist[lst][n][c] = INF; dist[lst][n][lst] = 0; for(int r = n - 1; r >= 0; r--){ priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; for(int c = 0; c < m; c++){ dist[lst][r][c] = dist[lst][r + 1][c] + v[r][c]; pq.push({dist[lst][r][c], c}); } while(!pq.empty()){ int d = pq.top().first, c = pq.top().second; pq.pop(); if(c != 0){ if(d + h[r][c - 1] < dist[lst][r][c - 1]){ dist[lst][r][c - 1] = d + h[r][c - 1]; pq.push({dist[lst][r][c - 1], c - 1}); } } if(c != m - 1){ if(d + h[r][c] < dist[lst][r][c + 1]){ dist[lst][r][c + 1] = d + h[r][c]; pq.push({dist[lst][r][c + 1], c + 1}); } } } } } } void init(int R, int C, int H[5000][200], int V[5000][200]) { n = R, m = C; for(int i = 0; i < n; i++){ for(int j = 0; j < m - 1; j++){ h[i][j] = H[i][j]; } } for(int i = 0; i < n - 1; i++){ for(int j = 0; j < m; j++){ v[i][j] = V[i][j]; } } calc_dist(); } void changeH(int P, int Q, int W) { h[P][Q] = W; calc_dist(); } void changeV(int P, int Q, int W) { v[P][Q] = W; calc_dist(); } int escape(int V1, int V2) { return dist[V2][0][V1]; }

Compilation message (stderr)

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  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...