Submission #64411

# Submission time Handle Problem Language Result Execution time Memory
64411 2018-08-04T10:54:20 Z theknife2001 Wombats (IOI13_wombats) C++17
12 / 100
16068 ms 19232 KB
#include "wombats.h"
#include <bits/stdc++.h>
#define ii pair< int , int>
#define se second
#define fi first

using namespace std;
const int N=5e3+55;
int sum[N][2][2];
int v[N][2];
int h[N][2];
int n,m;
map < ii , int > mp;
vector < ii > vec[N];

void init(int R, int C, int H[][200], int V[][200])
{
    n=R;
    m=C;
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            v[i][j]=V[i][j];
            h[i][j]=H[i][j];
            if(j+1!=m)
            {
                vec[cnt].push_back({cnt+1,h[i][j]});
                vec[cnt+1].push_back({cnt,h[i][j]});
            }
            if(i+1!=n)
                vec[cnt].push_back({cnt+m,v[i][j]});
            mp[{i,j}]=cnt;
            cnt++;
        }
    }
}

void changeH(int P, int Q, int W)
{
    h[P][Q]=W;
}

void changeV(int P, int Q, int W)
{
    v[P][Q]=W;

}

priority_queue < ii , vector < ii > , greater < ii > > pq;
int dist[5000000];

int escape(int V1, int V2)
{
    pq.push({0,V1});
    for(int i=0;i<50000;i++)
        dist[i]=1e9;
    int u,c;
    dist[V1]=0;
    while(pq.size())
    {
        u=pq.top().se;
        c=pq.top().fi;
        pq.pop();
        if(dist[u]<c)
            continue ;
        int v,d;
        for(int i=0;i<vec[u].size();i++)
        {
            v=vec[u][i].fi;
            d=vec[u][i].se;
            if(d+c<dist[v])
            {
                dist[v]=d+c;
                pq.push({c+d,v});
            }
        }
    }

    return dist[mp[{n-1,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: In function 'int escape(int, int)':
wombats.cpp:69:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<vec[u].size();i++)
                     ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 77 ms 5240 KB Output is correct
2 Incorrect 79 ms 5276 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5276 KB Output is correct
2 Correct 3 ms 5276 KB Output is correct
3 Correct 3 ms 5276 KB Output is correct
4 Correct 40 ms 5276 KB Output is correct
5 Correct 26 ms 5276 KB Output is correct
6 Correct 23 ms 5276 KB Output is correct
7 Correct 49 ms 5276 KB Output is correct
8 Correct 34 ms 5276 KB Output is correct
9 Correct 37 ms 5276 KB Output is correct
10 Correct 31 ms 5276 KB Output is correct
11 Correct 16068 ms 5276 KB Output is correct
12 Correct 43 ms 5276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 5276 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 19232 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 19232 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 19232 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -