답안 #940555

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940555 2024-03-07T10:33:53 Z vjudge1 웜뱃 (IOI13_wombats) C++17
12 / 100
13829 ms 26536 KB
//#pragma once 
#include "wombats.h"
#include <bits/stdc++.h>
#define f first
#define s second
const int INF = 1e9 + 7;
using namespace std;
const int G = 200000 + 10;
int n,m;
set <pair <int,int> > reb[G];
int A[5000][200],B[5000][200];
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++) {
            reb[i*m + j].insert({i*m + j + 1,H[i][j]});
            reb[i*m + j + 1].insert({i*m + j,H[i][j]});
        }
    }
    for(int i = 0;i < R;i++) {
        for(int j = 0;j < C;j++) {
            A[i][j] = H[i][j];
            B[i][j] = V[i][j];
        }
    }
    for(int i = 0;i < n - 1;i++) {
        for(int j = 0;j < m;j++) {
            reb[i*m + j].insert({(i + 1)*m + j,V[i][j]});
        }
    }
};
void changeH(int P, int Q, int W) {
    int v1 = P*m + Q,v2 = P*m + Q + 1;
    reb[v1].erase({A[P][Q],v2});
    reb[v2].erase({A[P][Q],v1});
    A[P][Q] = W;
    reb[v1].insert({A[P][Q],v2});
    reb[v2].insert({A[P][Q],v1});
};
void changeV(int P, int Q, int W) {
    int v1 = P*m + Q,v2 = (P + 1)*m + Q;
    reb[v1].erase({B[P][Q],v2});
    reb[v2].erase({B[P][Q],v1});
    B[P][Q] = W;
    reb[v1].insert({B[P][Q],v2});
    reb[v2].insert({B[P][Q],v1});
};
int dijkstra(int x,int y) {
    int rast[n*m] = {};
    for(int i = 0;i < n*m;i++) {
        rast[i] = INF;
    }
    rast[x] = 0;
    set <pair <int,int> > s;
    s.insert({0,x});
    while(!s.empty()) {
        pair <int,int> v = *s.begin();
        s.erase(s.find(v));
        for(auto u:reb[v.s]) {
            int rst = u.s + v.f;
            if(rst < rast[u.f]) {
                s.erase({rast[u.f],u.f});
                rast[u.f] = rst;
                s.insert({rast[u.f],u.f});
            }
        }
    }
    return rast[m*(n - 1) + y];
}
int escape(int V1, int V2) {
    int x = V1,y = V2;
    return dijkstra(x,y);
};
/*
signed main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for(int i = 0;i < n;i++) {
        for(int j = 0;j < m - 1;j++) {
            cin >> H[i][j];
        }
    }
    for(int i = 0;i < n - 1;i++) {
        for(int j = 0;j < m;j++) {
            cin >> V[i][j];
        }
    }
    init(n,m);
    int q;
    cin >> q;
    while(q--) {
        int type;
        cin >> type;
        if(type == 3) {
            int x,y;
            cin >> x >> y;
            cout << escape(x,y) << endl;
        }
        else {
            int a,b,c;
            cin >> a >> b >> c;
        }
    }
}
*/

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 131 ms 23716 KB Output is correct
2 Incorrect 117 ms 23724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 14940 KB Output is correct
2 Correct 3 ms 15044 KB Output is correct
3 Correct 3 ms 14940 KB Output is correct
4 Correct 26 ms 16988 KB Output is correct
5 Correct 15 ms 16988 KB Output is correct
6 Correct 16 ms 16988 KB Output is correct
7 Correct 35 ms 16988 KB Output is correct
8 Correct 32 ms 17152 KB Output is correct
9 Correct 29 ms 16988 KB Output is correct
10 Correct 26 ms 16984 KB Output is correct
11 Correct 13829 ms 19752 KB Output is correct
12 Correct 31 ms 16988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 228 ms 18524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 620 ms 26536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 224 ms 18524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 227 ms 18672 KB Output isn't correct
2 Halted 0 ms 0 KB -