#include "Annalib.h"
static long long D[300][300];
void Anna(int N,int M,int A[],int B[],long long C[],int Q,int S[],int T[],int K,int U[])
{
int i,j,k;
for(i=0;i<N;i++)for(j=0;j<N;j++)D[i][j]=1e18;
for(i=0;i<M;i++)D[A[i]][B[i]]=D[B[i]][A[i]]=C[i];
for(k=0;k<N;k++)for(i=0;i<N;i++)for(j=0;j<N;j++)if(D[i][j]>D[i][k]+D[k][j])D[i][j]=D[i][k]+D[k][j];
for(i=0;i<Q;i++)
{
for(j=0;j<K;j++)if(D[S[i]][A[U[j]]]+C[U[j]]+D[B[U[j]]][T[i]]==D[S[i]][T[i]])break;
Tap((j>>2)&1);
Tap((j>>1)&1);
Tap(j&1);
}
}
#include "Brunolib.h"
static long long D[300][300];
static long long V[300][300];
static void answer(int i,int j)
{
if(V[i][j]>0)Answer(V[i][j]);
else
{
answer(i,-V[i][j]-1);
answer(-V[i][j]-1,j);
}
}
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 i,j,k;
for(i=0;i<N;i++)for(j=0;j<N;j++)D[i][j]=1e18;
for(i=0;i<M;i++)if(C[i]>0)
{
D[A[i]][B[i]]=D[B[i]][A[i]]=C[i];
V[A[i]][B[i]]=i+1;
}
for(k=0;k<N;k++)for(i=0;i<N;i++)for(j=0;j<N;j++)if(D[i][j]>D[i][k]+D[k][j])
{
D[i][j]=D[i][k]+D[k][j];
V[i][j]=-k-1;
}
for(i=0;i<Q;i++)
{
j=(X[i*3]<<2)&(X[i*3+1]<<1)&X[i*3+2];
if(j<K)
{
answer(S[i],A[j]);
Answer(j);
answer(B[j],T[i]);
}
else answer(S[i],T[i]);
Answer(-1);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Memory limit exceeded |
122 ms |
262144 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Memory limit exceeded |
129 ms |
262144 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Memory limit exceeded |
102 ms |
262144 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Memory limit exceeded |
96 ms |
262144 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Memory limit exceeded |
102 ms |
262144 KB |
Memory limit exceeded |
2 |
Memory limit exceeded |
99 ms |
262144 KB |
Memory limit exceeded |
3 |
Memory limit exceeded |
109 ms |
262144 KB |
Memory limit exceeded |
4 |
Memory limit exceeded |
99 ms |
262144 KB |
Memory limit exceeded |
5 |
Memory limit exceeded |
92 ms |
262144 KB |
Memory limit exceeded |
6 |
Memory limit exceeded |
142 ms |
262144 KB |
Memory limit exceeded |
7 |
Memory limit exceeded |
102 ms |
262144 KB |
Memory limit exceeded |
8 |
Memory limit exceeded |
108 ms |
262144 KB |
Memory limit exceeded |
9 |
Memory limit exceeded |
135 ms |
262144 KB |
Memory limit exceeded |
10 |
Memory limit exceeded |
108 ms |
262144 KB |
Memory limit exceeded |
11 |
Memory limit exceeded |
108 ms |
262144 KB |
Memory limit exceeded |
12 |
Memory limit exceeded |
119 ms |
262144 KB |
Memory limit exceeded |
13 |
Incorrect |
212 ms |
12076 KB |
Output isn't correct - Wrong Answer [7] |
14 |
Memory limit exceeded |
108 ms |
262144 KB |
Memory limit exceeded |
15 |
Memory limit exceeded |
125 ms |
262144 KB |
Memory limit exceeded |
16 |
Memory limit exceeded |
122 ms |
262144 KB |
Memory limit exceeded |
17 |
Memory limit exceeded |
111 ms |
262144 KB |
Memory limit exceeded |
18 |
Memory limit exceeded |
112 ms |
262144 KB |
Memory limit exceeded |
19 |
Memory limit exceeded |
89 ms |
262144 KB |
Memory limit exceeded |
20 |
Memory limit exceeded |
142 ms |
262144 KB |
Memory limit exceeded |
21 |
Memory limit exceeded |
159 ms |
262144 KB |
Memory limit exceeded |
22 |
Memory limit exceeded |
112 ms |
262144 KB |
Memory limit exceeded |
23 |
Memory limit exceeded |
108 ms |
262144 KB |
Memory limit exceeded |
24 |
Memory limit exceeded |
118 ms |
262144 KB |
Memory limit exceeded |