제출 #733188

#제출 시각아이디문제언어결과실행 시간메모리
733188yeyso게임 (APIO22_game)C++17
12 / 100
4027 ms12112 KiB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
int n;
int x;
int y;
int k;
void init(int n, int k) {
    //n += 1;
    vector<vector<int>> matrix(n, vector<int>(n, INT_MAX / 3));
    vector<vector<int>> dma(n, vector<int>(n, INT_MAX / 3));
    adj = matrix;
    for(int i = 0; i < k - 1; i ++){
        adj[i][i+1] = -1;
        /*for(int j = 0; j < n; j ++){
            adj[i][j] = -1;
            adj[j][i] = -1;
        }*/
        //dma[i][i+1] = -1;
    }
    /*for(int i = 0; i < n; i ++){
        for(int j = 0; j < k - 1;)
    }*/
    x = n;
    y = k;
}

int add_teleporter(int u, int v) {
    n = x;
    k = y;
    adj[u][v] = min(adj[u][v], 0);
    if(u < k){
        adj[u][v] = -1;
    }
    if(v < k){
        adj[u][v] = -1;
    }

    for(int k = 0; k < n; k ++){
        for(int i = 0; i < n; i ++){
            for(int j = 0; j < n; j ++){
                adj[i][j] = min(adj[i][j], adj[i][k]+adj[k][j]);
            }
        }
    }
    for(int i = 0; i < n; i ++){
        if(adj[i][i] < 0){
            return 1;
        }
    }
    /*for(int i = 0; i < n; i ++){
        for(int j = 0; j < n; j ++){
            cout << adj[i][j] << " ";
        } cout << "\n";
    } cout << "\n";*/
    return 0;
}
/*
g++ -std=gnu++17 -O2 -pipe -o game grader.cpp game.cpp
6 5 3
3 4
5 0
4 5
5 3
1 4
4 1 2
1 0


*/
#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...