답안 #259079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
259079 2020-08-07T07:01:08 Z 반딧불(#5071) 한자 끝말잇기 (JOI14_kanji) C++14
0 / 100
1000 ms 262148 KB
#include <bits/stdc++.h>
#include "Annalib.h"

using namespace std;

typedef long long ll;

void Anna(int n, int k, int A[], int B[], ll C[], int q, int S[], int T[], int m, int U[]) {
    ll dist[302][302]={{0}};
    int track[302][302]={{0}};
    int message[302]={0};
    bool know[302]={0};
    ll dt[302]={0};

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(i!=j) dist[i][j] = 4 * 1e18;
        }
    }
    for(int i=0; i<m; i++) know[U[i]] = 1;
    for(int i=0; i<k; i++){
        if(!know[i]) dist[A[i]][B[i]] = C[i];
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            for(int x=0; x<n; x++){
                if(dist[i][x] + dist[x][j] < dist[i][j]){
                    track[i][j] = x;
                    dist[i][j] = dist[i][x] + dist[x][j];
                }
            }
        }
    }

    int stP = A[U[0]];

    for(int i=0; i<q; i++){
        dt[i] = dist[S[i]][T[i]];
        for(int j=0; j<m; j++){
            if(dt[i] > dist[S[i]][stP] + C[U[j]] + dist[B[U[j]]][T[i]]){
                dt[i] = dist[S[i]][stP] + C[U[j]] + dist[B[U[j]]][T[i]];
                message[i] = j+1;
            }
        }
    }
    for(int i=0; i<60; i+=3){
        int mes = message[i] + message[i+1] * 6 + message[i+2] * 36;
        for(int j=0; j<8; j++){
            Tap(!!(mes & (1<<j)));
        }
    }
}
#include <bits/stdc++.h>
#include "Brunolib.h"

using namespace std;

typedef long long ll;
int track[302][302]={{0}};

void answer(int x, int y){
    if(x==y) return;
    if(track[x][y] < 0){
        Answer(-track[x][y]-100);
        return;
    }
    int z = track[x][y];
    answer(x, z);
    answer(z, y);
}

void Bruno(int n, int k, int A[], int B[], ll C[], int q, int S[], int T[], int m, int U[], int L, int X[]) {
    ll dist[302][302]={{0}};
    int message[302]={0};
    bool know[302]={0};

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(i!=j) dist[i][j] = 4 * 1e18;
        }
    }
    for(int i=0; i<m; i++) know[U[i]] = 1;
    for(int i=0; i<k; i++){
        if(!know[i]) dist[A[i]][B[i]] = C[i], track[A[i]][B[i]] = -i-100;
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            for(int x=0; x<n; x++){
                if(dist[i][x] + dist[x][j] < dist[i][j]){
                    track[i][j] = x;
                    dist[i][j] = dist[i][x] + dist[x][j];
                }
            }
        }
    }

    for(int i=0; i<60; i+=3){
        int mes = 0;
        for(int j=0; j<8; j++){
            mes += (1<<j) * X[i/3*8+j];
        }
        message[i] = mes % 6;
        message[i+1] = mes / 6 % 6;
        message[i+2] = mes / 36;
    }

    for(int i=0; i<q; i++){
        if(message[i] == 0){
            answer(S[i], T[i]);
        }
        else{
            answer(S[i], A[U[0]]);
            Answer(U[message[i] - 1]);
            answer(B[U[message[i]-1]], T[i]);
        }
        Answer(-1);
    }
}

Compilation message

Anna.cpp: In function 'void Anna(int, int, int*, int*, ll*, int, int*, int*, int, int*)':
Anna.cpp:10:9: warning: variable 'track' set but not used [-Wunused-but-set-variable]
     int track[302][302]={{0}};
         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 214 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 223 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 213 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 212 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 212 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 209 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 209 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 216 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 228 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 227 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 219 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 214 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 210 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 220 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
11 Runtime error 207 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
12 Runtime error 213 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
13 Incorrect 188 ms 17904 KB Output isn't correct - Wrong Answer [9]
14 Execution timed out 1085 ms 6680 KB Time limit exceeded
15 Runtime error 216 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
16 Runtime error 220 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
17 Incorrect 78 ms 6868 KB Output isn't correct - Wrong Answer [9]
18 Incorrect 80 ms 7504 KB Output isn't correct - Wrong Answer [9]
19 Runtime error 238 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
20 Incorrect 96 ms 7952 KB Output isn't correct - Wrong Answer [9]
21 Incorrect 89 ms 7900 KB Output isn't correct - Wrong Answer [9]
22 Runtime error 217 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
23 Runtime error 225 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
24 Runtime error 206 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)