Submission #69308

# Submission time Handle Problem Language Result Execution time Memory
69308 2018-08-20T12:06:21 Z MKopchev Wombats (IOI13_wombats) C++14
16 / 100
20000 ms 26380 KB
#include<bits/stdc++.h>
#include"wombats.h"
using namespace std;
const int rmax=5e3+5,cmax=2e2+5;
int r,c,h[rmax][cmax],v[rmax][cmax];
bool run=0;
void init(int R,int C,int H[5000][200],int V[5000][200])
{
    r=R;
    c=C;
    for(int i=0;i<R;i++)
        for(int j=0;j<C-1;j++)
        h[i][j]=H[i][j];
    for(int i=0;i<R-1;i++)
        for(int j=0;j<C;j++)
        v[i][j]=V[i][j];
    run=1;
}
void changeH(int P,int Q,int W)
{
    h[P][Q]=W;
    run=1;
}
void changeV(int P,int Q,int W)
{
    v[P][Q]=W;
    run=1;
}
int dist[rmax][cmax];
priority_queue< pair<int,pair<int,int> > > pq,idle;
int dij(int x1,int y1,int x2,int y2)
{
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++)
            dist[i][j]=-1;
    pq=idle;
        pq.push({0,{x1,y1}});
    pair<int,pair<int,int> > p;
    int d,x,y;
    while(pq.size())
    {
        p=pq.top();
        pq.pop();
        d=-p.first;
        x=p.second.first;
        y=p.second.second;
        //cout<<x<<" "<<y<<" -> "<<d<<endl;
        if(dist[x][y]!=-1)continue;
        dist[x][y]=d;
        if(x==x2&&y==y2)return d;
        if(x!=r-1)pq.push({-(d+v[x][y]),{x+1,y}});
        if(y)pq.push({-(d+h[x][y-1]),{x,y-1}});
        if(y!=c-1)pq.push({-(d+h[x][y]),{x,y+1}});
    }
    assert(0==1);
}
int escape(int V1,int V2)
{
    return dij(0,V1,r-1,V2);
}
/*
int H[5000][200]={
{0,2,5},
{7,1,1},
{0,4,0}
};
int V[5000][200]={
{0,0,0,2},
{0,3,4,7},
};
int main()
{
init(3,4,H,V);
cout<<escape(2,1)<<endl;//2
cout<<escape(3,3)<<endl;//7
changeV(0,0,5);
changeH(1,1,6);
cout<<escape(2,1)<<endl;//5
return 0;
}
*/

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;
      ^~~
# Verdict Execution time Memory Grader output
1 Correct 120 ms 12408 KB Output is correct
2 Correct 123 ms 12420 KB Output is correct
3 Execution timed out 20038 ms 14124 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14124 KB Output is correct
2 Correct 3 ms 14124 KB Output is correct
3 Correct 2 ms 14124 KB Output is correct
4 Correct 32 ms 14124 KB Output is correct
5 Correct 5 ms 14124 KB Output is correct
6 Correct 48 ms 14124 KB Output is correct
7 Correct 44 ms 14124 KB Output is correct
8 Correct 44 ms 14124 KB Output is correct
9 Correct 41 ms 14124 KB Output is correct
10 Correct 37 ms 14124 KB Output is correct
11 Execution timed out 20068 ms 14124 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 347 ms 14124 KB Output is correct
2 Correct 388 ms 14124 KB Output is correct
3 Correct 349 ms 14124 KB Output is correct
4 Correct 356 ms 14124 KB Output is correct
5 Correct 392 ms 14124 KB Output is correct
6 Correct 2 ms 14124 KB Output is correct
7 Correct 2 ms 14124 KB Output is correct
8 Correct 3 ms 14124 KB Output is correct
9 Correct 415 ms 14124 KB Output is correct
10 Correct 3 ms 14124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1538 ms 23572 KB Output is correct
2 Correct 2522 ms 23572 KB Output is correct
3 Correct 1420 ms 23684 KB Output is correct
4 Execution timed out 20079 ms 24216 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 338 ms 24216 KB Output is correct
2 Correct 348 ms 24216 KB Output is correct
3 Correct 347 ms 24216 KB Output is correct
4 Correct 334 ms 24216 KB Output is correct
5 Correct 331 ms 24216 KB Output is correct
6 Correct 1408 ms 24532 KB Output is correct
7 Correct 2327 ms 24540 KB Output is correct
8 Correct 1263 ms 24640 KB Output is correct
9 Execution timed out 20050 ms 25268 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 357 ms 25268 KB Output is correct
2 Correct 385 ms 25268 KB Output is correct
3 Correct 350 ms 25268 KB Output is correct
4 Correct 367 ms 25268 KB Output is correct
5 Correct 348 ms 25268 KB Output is correct
6 Correct 1363 ms 25604 KB Output is correct
7 Correct 2738 ms 25704 KB Output is correct
8 Correct 1502 ms 25732 KB Output is correct
9 Execution timed out 20005 ms 26380 KB Time limit exceeded
10 Halted 0 ms 0 KB -