Submission #101768

# Submission time Handle Problem Language Result Execution time Memory
101768 2019-03-20T01:29:42 Z cheeheng 한자 끝말잇기 (JOI14_kanji) C++14
10 / 100
133 ms 19108 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

void Anna(int N, int M, int A[], int B[], long long C[], int Q, int S[], int T[], int K, int U[]){
    for(int i = 0; i < K; i ++){
        long long temp = C[U[i]];
        for(int i = 53; i >= 0; i --){
            if(temp&(1LL<<i)){
                Tap(1);
            }else{
                Tap(0);
            }
        }
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

const long long INF = 4e18;

typedef pair<long long, long long> ii;
vector<ii> AdjList[305];
long long dist[305];
int p[305];

int EdgeList[305][305];

void Bruno(int N, int M, int A[], int B[], long long C[], int Q, int S[], int T[], int K, int U[], int L, int X[]) {
    int cnt = 0;
    for(int k = 0; k < 5; k ++){
        C[U[k]] = 0;
        for(int i = 53; i >= 0; i --){
            C[U[k]] |= (long long)X[cnt++] << i;
        }
    }

    memset(EdgeList, -1, sizeof(EdgeList));

    for(int i = 0; i < M; i ++){
        AdjList[A[i]].push_back(ii(B[i], C[i]));
        EdgeList[A[i]][B[i]] = i;
    }

    for(int i = 0; i < Q; i ++){
        memset(p, -1, sizeof(p));
        for(int j = 0; j < N; j ++){
            dist[j] = INF;
        }
        dist[S[i]] = 0;

        priority_queue<ii, vector<ii>, greater<ii> > pq;
        pq.push(ii(0, S[i]));
        //printf("3\n");
        while(!pq.empty()){
            ii temp = pq.top(); pq.pop();
            long long d = temp.first;
            int u = temp.second;
            //printf("%d %d %lld\n", T[i], u, d);
            if(d > dist[u]){continue;}
            for(ii v: AdjList[u]){
                if(dist[v.first] > dist[u] + v.second){
                    dist[v.first] = dist[u] + v.second;
                    p[v.first] = u;
                    pq.push(ii(dist[v.first], v.first));
                }
            }
        }

        vector<int> stack1;
        int temp = T[i];
        do{
            stack1.push_back(temp);
            temp = p[temp];
        }while(temp != -1);
        reverse(stack1.begin(), stack1.end());

        //printf("dist[T[i]] = %lld\n", dist[T[i]]);
        for(int i = 1; i < (int)stack1.size(); i ++){
            //printf("%d %d %d\n", stack1[i-1], stack1[i], EdgeList[stack1[i-1]][stack1[i]]);
            Answer(EdgeList[stack1[i-1]][stack1[i]]);
        }
        //printf("\n");
        Answer(-1);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4980 KB Output is correct - L = 270
2 Correct 9 ms 4812 KB Output is correct - L = 270
3 Correct 10 ms 4924 KB Output is correct - L = 270
4 Correct 9 ms 4900 KB Output is correct - L = 270
5 Correct 9 ms 4920 KB Output is correct - L = 270
6 Correct 10 ms 4892 KB Output is correct - L = 270
7 Correct 10 ms 4976 KB Output is correct - L = 270
8 Correct 11 ms 4928 KB Output is correct - L = 270
9 Correct 12 ms 5128 KB Output is correct - L = 270
10 Correct 15 ms 5324 KB Output is correct - L = 270
11 Correct 10 ms 4780 KB Output is correct - L = 270
12 Correct 133 ms 18740 KB Output is correct - L = 270
13 Correct 9 ms 4916 KB Output is correct - L = 270
14 Correct 9 ms 4916 KB Output is correct - L = 54
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 5164 KB Output isn't correct - L = 270
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 5164 KB Output isn't correct - L = 270
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 5456 KB Output isn't correct - L = 270
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 5252 KB Output isn't correct - L = 270
2 Incorrect 10 ms 5044 KB Output isn't correct - L = 270
3 Incorrect 12 ms 5172 KB Output isn't correct - L = 270
4 Incorrect 11 ms 5164 KB Output isn't correct - L = 270
5 Incorrect 12 ms 4916 KB Output isn't correct - L = 270
6 Incorrect 12 ms 5052 KB Output isn't correct - L = 270
7 Incorrect 12 ms 5236 KB Output isn't correct - L = 270
8 Incorrect 13 ms 5200 KB Output isn't correct - L = 270
9 Incorrect 36 ms 5324 KB Output isn't correct - L = 270
10 Incorrect 10 ms 5296 KB Output isn't correct - L = 270
11 Incorrect 12 ms 5324 KB Output isn't correct - L = 270
12 Incorrect 11 ms 5224 KB Output isn't correct - L = 270
13 Incorrect 130 ms 19108 KB Output isn't correct - L = 270
14 Incorrect 11 ms 5172 KB Output isn't correct - L = 270
15 Incorrect 12 ms 5180 KB Output isn't correct - L = 270
16 Incorrect 15 ms 5500 KB Output isn't correct - L = 270
17 Incorrect 16 ms 5588 KB Output isn't correct - L = 270
18 Incorrect 20 ms 6404 KB Output isn't correct - L = 270
19 Incorrect 10 ms 4960 KB Output isn't correct - L = 270
20 Incorrect 22 ms 6696 KB Output isn't correct - L = 270
21 Incorrect 30 ms 6676 KB Output isn't correct - L = 270
22 Incorrect 11 ms 5324 KB Output isn't correct - L = 270
23 Incorrect 10 ms 5316 KB Output isn't correct - L = 270
24 Incorrect 10 ms 5324 KB Output isn't correct - L = 270