Submission #133876

#TimeUsernameProblemLanguageResultExecution timeMemory
133876arthurconmyWombats (IOI13_wombats)C++14
28 / 100
20074 ms17672 KiB
#include <bits/stdc++.h> #ifndef ARTHUR_LOCAL #include "wombats.h" #endif using namespace std; using pii=pair<int,int>; const int INF = 1000000000; int r=-1; int c=-1; int H[5000][200]; int V[5000][200]; vector<pii> adj[10000]; int dis[10000]; void init(int r_raw, int c_raw, int H_raw[5000][200], int V_raw[5000][200]) { r=r_raw; c=c_raw; for(int i=0; i<5000; i++) { for(int j=0; j<200; j++) { H[i][j]=H_raw[i][j]; V[i][j]=V_raw[i][j]; } } for(int i=0; i<10000; i++) { int row=int(i/c); int col=i%c; if(row>=r) break; // << "RC: " << row << " " << col << endl; if(row < r-1) { // dis[i][i+c] = V[row][col]; //cout << i << " " << i+c << " " << V[row][col] << " V" << endl; adj[i].push_back(make_pair(i+c,V[row][col])); } if(col < c-1) { // dis[i][i+1] = H[row][col]; // dis[i+1][i] = H[row][col]; //cout << i << " " << i+1 << " " << H[row][col] << " H" << endl; adj[i].push_back(make_pair(i+1,H[row][col])); adj[i+1].push_back(make_pair(i,H[row][col])); } } // cout << "here" << endl; } void changeH(int p, int q, int w) { for(int i=0; i<adj[p*c + q].size(); i++) { pii u = adj[p*c + q][i]; if(u.first == p*c + q + 1) { adj[p*c + q][i] = {u.first, w}; break; } } for(int i=0; i<adj[p*c + q + 1].size(); i++) { pii u = adj[p*c + q + 1][i]; if(u.first == p*c + q) { adj[p*c + q + 1][i] = {u.first, w}; break; } } } void changeV(int p, int q, int w) { for(int i=0; i<adj[p*c + q].size(); i++) { pii u = adj[p*c + q][i]; if(u.first == p*c + q + c) { adj[p*c + q][i] = {u.first,w}; break; } } for(int i=0; i<adj[p*c + q + c].size(); i++) { pii u = adj[p*c + q + c][i]; if(u.first == p*c + q) { adj[p*c + q + c][i] = {u.first,w}; break; } } } int escape(int v1, int v2) { for(int i=0; i<10000; i++) dis[i]=INF; priority_queue<pii> PQ; PQ.push(make_pair(-0,v1)); while(!PQ.empty()) { int v = PQ.top().second; int cur_dis = -PQ.top().first; PQ.pop(); if(dis[v]!=INF) continue; //if(v1==3) cout << v << " " << cur_dis << endl; dis[v]=cur_dis; for(auto pear:adj[v]) { int jump=pear.second; int w=pear.first; if(dis[w]==INF) { PQ.push(make_pair(-cur_dis-jump,w)); } } } #ifdef ARTHUR_LOCAL cout << dis[c*(r-1) + v2] << endl; #endif return dis[c*(r-1) + v2]; }

Compilation message (stderr)

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: In function 'void changeH(int, int, int)':
wombats.cpp:65:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<adj[p*c + q].size(); i++)
               ~^~~~~~~~~~~~~~~~~~~~
wombats.cpp:76:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<adj[p*c + q + 1].size(); i++)
               ~^~~~~~~~~~~~~~~~~~~~~~~~
wombats.cpp: In function 'void changeV(int, int, int)':
wombats.cpp:90:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<adj[p*c + q].size(); i++)
               ~^~~~~~~~~~~~~~~~~~~~
wombats.cpp:101:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<adj[p*c + q + c].size(); i++)
               ~^~~~~~~~~~~~~~~~~~~~~~~~
#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...