Submission #117357

# Submission time Handle Problem Language Result Execution time Memory
117357 2019-06-15T15:08:36 Z 김세빈(#2870) 한자 끝말잇기 (JOI14_kanji) C++14
0 / 100
182 ms 19788 KB
#include <bits/stdc++.h>

#include "Annalib.h"

using namespace std;

typedef long long ll;

static ll D[333][333];
static vector <int> G[333];

void Anna(int N, int M, int A[], int B[], ll C[], int Q, int S[], int T[], int K, int U[])
{
	vector <int> V;
	int i, j, k, x, t;
	
	for(i=0; i<N; i++){
		for(j=0; j<N; j++){
			D[i][j] = -1 * (i != j);
		}
	}
	
	for(i=0; i<M; i++){
		D[A[i]][B[i]] = C[i];
		G[A[i]].push_back(B[i]);
	}
	
	for(k=0; k<N; k++){
		for(i=0; i<N; i++){
			for(j=0; j<N; j++){
				if(D[i][k] == -1 || D[k][j] == -1) continue;
				if(D[i][j] == -1) D[i][j] = D[i][k] + D[k][j];
				else D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
			}
		}
	}
	
	x = A[U[0]];
	
	for(i=0; i<Q; i++){
		V.clear();
		
		for(j=S[i]; j!=T[i]; ){
			V.push_back(j);
			for(int &v: G[j]){
				if(D[j][v] == -1 || D[v][T[i]] == -1) continue;
				if(D[j][v] + D[v][T[i]] == D[j][T[i]]){
					j = v; break;
				}
			}
		}
		
		V.push_back(j);

		
		t = 0;
		
		for(j=0; j<V.size()-1; j++){
			if(V[j] == x) break;
		}
		
		if(j < V.size() - 1){
			for(k=0; k<K; k++){
				if(V[j + 1] == B[U[k]]) break;
			}
			if(k < K) t = k + 1;
		}
		
		Tap((t & 4)? 1 : 0);
		Tap((t & 2)? 1 : 0);
		Tap((t & 1)? 1 : 0);
	}
}
#include <bits/stdc++.h>

#include "Brunolib.h"

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

static ll D[333][333];
static vector <pii> G[333];

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[])
{
	vector <int> V;
	int i, j, k, t, v;
	
	for(i=0; i<N; i++){
		for(j=0; j<N; j++){
			D[i][j] = -1 * (i != j);
		}
	}
	
	for(i=0; i<M; i++){
		D[A[i]][B[i]] = C[i];
		G[A[i]].emplace_back(B[i], i);
	}
	
	for(k=0; k<N; k++){
		for(i=0; i<N; i++){
			for(j=0; j<N; j++){
				if(D[i][k] == -1 || D[k][j] == -1) continue;
				if(D[i][j] == -1) D[i][j] = D[i][k] + D[k][j];
				else D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
			}
		}
	}
	
	for(i=0; i<Q; i++){
		t = X[i * 3] * 4 + X[i * 3 + 1] * 2 + X[i * 3 + 2];
		if(t == 0){
			V.clear();
		
			for(j=S[i]; j!=T[i]; ){
				for(pii &p: G[j]){
					v = p.first;
					if(D[j][v] == -1 || D[v][T[i]] == -1) continue;
					if(D[j][v] + D[v][T[i]] == D[j][T[i]]){
						V.push_back(p.second);
						j = v; break;
					}
				}
			}
		}
		else{
			V.clear();
			
			for(j=S[i]; j!=A[U[t - 1]]; ){
				for(pii &p: G[j]){
					v = p.first;
					if(D[j][v] == -1 || D[v][A[U[t - 1]]] == -1) continue;
					if(D[j][v] + D[v][A[U[t - 1]]] == D[j][A[U[t - 1]]]){
						V.push_back(p.second);
						j = v; break;
					}
				}
			}
			
			V.push_back(U[t - 1]);
			
			for(j=B[U[t - 1]]; j!=T[i]; ){
				for(pii &p: G[j]){
					v = p.first;
					if(D[j][v] == -1 || D[v][T[i]] == -1) continue;
					if(D[j][v] + D[v][T[i]] == D[j][T[i]]){
						V.push_back(p.second);
						j = v; break;
					}
				}
			}
		}
		
		for(int &v: V) Answer(v);
		Answer(-1);
	}
}

Compilation message

Anna.cpp: In function 'void Anna(int, int, int*, int*, ll*, int, int*, int*, int, int*)':
Anna.cpp:58:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(j=0; j<V.size()-1; j++){
            ~^~~~~~~~~~~
Anna.cpp:62:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(j < V.size() - 1){
      ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 62 ms 6304 KB Output is correct - L = 30
2 Correct 63 ms 6196 KB Output is correct - L = 30
3 Correct 61 ms 6172 KB Output is correct - L = 30
4 Correct 59 ms 6144 KB Output is correct - L = 30
5 Correct 61 ms 6160 KB Output is correct - L = 30
6 Correct 61 ms 6184 KB Output is correct - L = 30
7 Correct 56 ms 6032 KB Output is correct - L = 30
8 Correct 65 ms 6156 KB Output is correct - L = 30
9 Correct 72 ms 6296 KB Output is correct - L = 30
10 Correct 78 ms 6620 KB Output is correct - L = 30
11 Correct 63 ms 6088 KB Output is correct - L = 3
12 Incorrect 176 ms 19452 KB Output isn't correct - Wrong Answer [9]
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 6436 KB Output is correct - L = 180
2 Correct 59 ms 6316 KB Output is correct - L = 180
3 Correct 58 ms 6572 KB Output is correct - L = 180
4 Correct 57 ms 6328 KB Output is correct - L = 180
5 Correct 70 ms 6196 KB Output is correct - L = 180
6 Correct 62 ms 6348 KB Output is correct - L = 180
7 Correct 65 ms 6436 KB Output is correct - L = 180
8 Correct 131 ms 6460 KB Output is correct - L = 180
9 Correct 57 ms 6460 KB Output is correct - L = 180
10 Correct 60 ms 6544 KB Output is correct - L = 180
11 Correct 60 ms 6476 KB Output is correct - L = 180
12 Correct 62 ms 6452 KB Output is correct - L = 180
13 Incorrect 180 ms 19788 KB Output isn't correct - Wrong Answer [9]
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 6724 KB Output isn't correct - L = 180
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 6328 KB Output isn't correct - L = 180
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 6436 KB Output isn't correct - L = 180
2 Incorrect 57 ms 6324 KB Output isn't correct - L = 180
3 Incorrect 59 ms 6332 KB Output isn't correct - L = 180
4 Incorrect 60 ms 6544 KB Output isn't correct - L = 180
5 Incorrect 63 ms 6032 KB Output isn't correct - L = 180
6 Incorrect 62 ms 6344 KB Output isn't correct - L = 180
7 Incorrect 59 ms 6444 KB Output isn't correct - L = 180
8 Incorrect 60 ms 6436 KB Output isn't correct - L = 180
9 Incorrect 56 ms 6460 KB Output isn't correct - L = 180
10 Incorrect 56 ms 6640 KB Output isn't correct - L = 180
11 Incorrect 56 ms 6460 KB Output isn't correct - L = 180
12 Incorrect 62 ms 6436 KB Output isn't correct - L = 180
13 Incorrect 182 ms 19484 KB Output isn't correct - Wrong Answer [9]
14 Incorrect 62 ms 6440 KB Output isn't correct - L = 180
15 Incorrect 59 ms 6196 KB Output isn't correct - L = 180
16 Incorrect 79 ms 6644 KB Output isn't correct - L = 180
17 Incorrect 82 ms 6740 KB Output isn't correct - L = 180
18 Incorrect 81 ms 7292 KB Output isn't correct - L = 180
19 Incorrect 57 ms 6128 KB Output isn't correct - Wrong Answer [9]
20 Incorrect 82 ms 7812 KB Output isn't correct - L = 180
21 Incorrect 88 ms 8036 KB Output isn't correct - Wrong Answer [9]
22 Incorrect 92 ms 6460 KB Output isn't correct - L = 180
23 Incorrect 59 ms 6448 KB Output isn't correct - L = 180
24 Incorrect 62 ms 6536 KB Output isn't correct - L = 180