답안 #259086

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

using namespace std;

typedef long long ll;

namespace ANNA{
    ll dist[302][302];
    int track[302][302];
    int message[302];
    bool know[302];
    ll dt[302];
};
using namespace ANNA;

void Anna(int n, int k, int A[], int B[], ll C[], int q, int S[], int T[], int m, int U[]) {
    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;

namespace BRUNO{
    ll dist[302][302];
    int track[302][302];
    int message[302];
    bool know[302];
    ll dt[302];
};
using namespace BRUNO;

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[]) {
    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);
//    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 60 ms 6576 KB Output isn't correct - Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 7072 KB Output isn't correct - Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 6956 KB Output isn't correct - Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 61 ms 6952 KB Output isn't correct - Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 59 ms 7068 KB Output isn't correct - Wrong Answer [5]
2 Incorrect 64 ms 6884 KB Output isn't correct - Wrong Answer [5]
3 Incorrect 59 ms 6848 KB Output isn't correct - Wrong Answer [5]
4 Incorrect 64 ms 6824 KB Output isn't correct - Wrong Answer [5]
5 Incorrect 60 ms 6828 KB Output isn't correct - Wrong Answer [5]
6 Incorrect 61 ms 6716 KB Output isn't correct - Wrong Answer [5]
7 Incorrect 61 ms 6948 KB Output isn't correct - Wrong Answer [5]
8 Incorrect 64 ms 7056 KB Output isn't correct - Wrong Answer [5]
9 Incorrect 65 ms 7184 KB Output isn't correct - Wrong Answer [5]
10 Incorrect 64 ms 7212 KB Output isn't correct - Wrong Answer [5]
11 Incorrect 65 ms 7188 KB Output isn't correct - Wrong Answer [5]
12 Incorrect 80 ms 7076 KB Output isn't correct - Wrong Answer [5]
13 Incorrect 185 ms 13996 KB Output isn't correct - Wrong Answer [5]
14 Incorrect 58 ms 6680 KB Output isn't correct - Wrong Answer [5]
15 Incorrect 60 ms 7096 KB Output isn't correct - Wrong Answer [5]
16 Incorrect 70 ms 7072 KB Output isn't correct - Wrong Answer [5]
17 Incorrect 74 ms 7168 KB Output isn't correct - Wrong Answer [5]
18 Incorrect 79 ms 7232 KB Output isn't correct - Wrong Answer [5]
19 Incorrect 62 ms 6584 KB Output isn't correct - Wrong Answer [5]
20 Incorrect 72 ms 7676 KB Output isn't correct - Wrong Answer [5]
21 Incorrect 79 ms 7660 KB Output isn't correct - Wrong Answer [5]
22 Incorrect 61 ms 7208 KB Output isn't correct - Wrong Answer [5]
23 Incorrect 64 ms 7188 KB Output isn't correct - Wrong Answer [5]
24 Incorrect 62 ms 6964 KB Output isn't correct - Wrong Answer [5]