# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
259089 |
2020-08-07T07:13:40 Z |
반딧불(#5071) |
한자 끝말잇기 (JOI14_kanji) |
C++14 |
|
203 ms |
18232 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 x=0; x<n; x++){
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
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;
}
}
if(dt[i] > 3*1e18) exit(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 x=0; x<n; x++){
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
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);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
6680 KB |
Output is correct - L = 160 |
2 |
Correct |
68 ms |
6640 KB |
Output is correct - L = 160 |
3 |
Correct |
70 ms |
6836 KB |
Output is correct - L = 160 |
4 |
Correct |
65 ms |
6608 KB |
Output is correct - L = 160 |
5 |
Correct |
66 ms |
6580 KB |
Output is correct - L = 160 |
6 |
Correct |
66 ms |
6444 KB |
Output is correct - L = 160 |
7 |
Correct |
62 ms |
6436 KB |
Output is correct - L = 160 |
8 |
Correct |
77 ms |
6584 KB |
Output is correct - L = 160 |
9 |
Correct |
79 ms |
7056 KB |
Output is correct - L = 160 |
10 |
Correct |
84 ms |
7176 KB |
Output is correct - L = 160 |
11 |
Correct |
68 ms |
6500 KB |
Output is correct - L = 160 |
12 |
Incorrect |
203 ms |
18232 KB |
Output isn't correct - Wrong Answer [9] |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
6804 KB |
Output is correct - L = 160 |
2 |
Incorrect |
64 ms |
6708 KB |
Output isn't correct - Wrong Answer [9] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
7076 KB |
Output is correct - L = 160 |
2 |
Incorrect |
63 ms |
6912 KB |
Output isn't correct - Wrong Answer [9] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
68 ms |
6676 KB |
Output isn't correct - L = 160 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
6804 KB |
Output isn't correct - L = 160 |
2 |
Incorrect |
65 ms |
6804 KB |
Output isn't correct - Wrong Answer [9] |
3 |
Incorrect |
66 ms |
6844 KB |
Output isn't correct - Wrong Answer [9] |
4 |
Correct |
68 ms |
6804 KB |
Output isn't correct - L = 160 |
5 |
Correct |
66 ms |
6596 KB |
Output isn't correct - L = 160 |
6 |
Correct |
104 ms |
6936 KB |
Output isn't correct - L = 160 |
7 |
Incorrect |
99 ms |
6824 KB |
Output isn't correct - Wrong Answer [9] |
8 |
Correct |
66 ms |
6812 KB |
Output isn't correct - L = 160 |
9 |
Correct |
64 ms |
7064 KB |
Output isn't correct - L = 160 |
10 |
Correct |
77 ms |
6876 KB |
Output isn't correct - L = 160 |
11 |
Incorrect |
65 ms |
7188 KB |
Output isn't correct - Wrong Answer [9] |
12 |
Correct |
67 ms |
6936 KB |
Output isn't correct - L = 160 |
13 |
Incorrect |
203 ms |
14192 KB |
Output isn't correct - Wrong Answer [9] |
14 |
Correct |
69 ms |
6836 KB |
Output isn't correct - L = 160 |
15 |
Incorrect |
65 ms |
7028 KB |
Output isn't correct - Wrong Answer [9] |
16 |
Incorrect |
75 ms |
6920 KB |
Output isn't correct - Wrong Answer [9] |
17 |
Incorrect |
84 ms |
7008 KB |
Output isn't correct - Wrong Answer [9] |
18 |
Incorrect |
90 ms |
7408 KB |
Output isn't correct - Wrong Answer [9] |
19 |
Correct |
65 ms |
6592 KB |
Output isn't correct - L = 160 |
20 |
Correct |
78 ms |
7680 KB |
Output isn't correct - L = 160 |
21 |
Incorrect |
93 ms |
7788 KB |
Output isn't correct - Wrong Answer [9] |
22 |
Correct |
67 ms |
7032 KB |
Output isn't correct - L = 160 |
23 |
Correct |
63 ms |
6948 KB |
Output isn't correct - L = 160 |
24 |
Correct |
63 ms |
6816 KB |
Output isn't correct - L = 160 |