# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
6145 |
2014-06-20T11:58:26 Z |
gs13068 |
한자 끝말잇기 (JOI14_kanji) |
C++ |
|
282 ms |
12436 KB |
#include "Annalib.h"
#include<algorithm>
static long long D[300][300];
static long long D2[300][300];
static long long G[60];
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,l;
for(i=0;i<N;i++)for(j=0;j<N;j++)D[i][j]=D2[i][j]=4e18;
for(i=0;i<M;i++)
{
D[A[i]][B[i]]=C[i];
for(j=0;j<K;j++)if(i==U[j])break;
if(j==K)D2[A[i]][B[i]]=C[i];
}
for(i=0;i<N;i++)D[i][i]=D2[i][i]=0;
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];
if(D2[i][j]>D2[i][k]+D2[k][j])D2[i][j]=D2[i][k]+D2[k][j];
}
for(i=0;i<K;i++)
{
for(j=0;j<Q;j++)G[j]=D2[S[j]][T[j]]-D2[S[j]][A[U[i]]]-D2[B[U[i]]][T[j]];
std::sort(G,G+Q);
j=std::lower_bound(G,G+Q,C[U[i]])-G;
for(k=0;k<6;k++)Tap((j>>k)&1);
}
for(i=0;i<K;i++)for(j=i+1;j<K;j++)
{
for(k=0;k<Q;k++)G[k]=D2[B[U[i]]][T[k]]-D2[B[U[j]]][T[k]];
std::sort(G,G+Q);
k=std::lower_bound(G,G+Q,C[U[j]]-C[U[i]])-G;
for(l=0;l<6;l++)Tap((k>>l)&1);
}
}
#include "Brunolib.h"
#include<algorithm>
static long long D[300][300];
static int V[300][300];
static std::pair<long long,int> G[60];
static int Y[60];
static void answer(int i,int j)
{
if(V[i][j]>0)Answer(V[i][j]-1);
if(V[i][j]<0)
{
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,l,p;
for(i=0;i<N;i++)for(j=0;j<N;j++)D[i][j]=4e18;
for(i=0;i<M;i++)if(C[i]>0)
{
D[A[i]][B[i]]=C[i];
V[A[i]][B[i]]=i+1;
}
for(i=0;i<N;i++)
{
D[i][i]=0;
V[i][i]=0;
}
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++)Y[i]=K;
p=0;
for(i=0;i<K;i++)
{
for(j=0;j<Q;j++)
{
G[j].first=D[S[j]][T[j]]-D[S[j]][A[U[i]]]-D[B[U[i]]][T[j]];
G[j].second=j;
}
std::sort(G,G+Q);
j=0;
for(k=0;k<6;k++)j|=X[p++]<<k;
for(k=j;k<Q;k++)if(Y[G[k].second]==K)Y[G[k].second]=i;
}
for(i=0;i<K;i++)for(j=i+1;j<K;j++)
{
for(k=0;k<Q;k++)
{
G[k].first=D[B[U[i]]][T[k]]-D[B[U[j]]][T[k]];
G[k].second=k;
}
std::sort(G,G+Q);
k=0;
for(l=0;l<6;l++)k|=X[p++]<<l;
for(l=k;l<Q;l++)if(Y[G[l].second]==i)Y[G[l].second]=j;
}
for(i=0;i<Q;i++)
{
if(Y[i]==K)answer(S[i],T[i]);
else
{
answer(S[i],A[U[Y[i]]]);
Answer(U[Y[i]]);
answer(B[U[Y[i]]],T[i]);
}
Answer(-1);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
12436 KB |
Output is correct - L = 90 |
2 |
Correct |
78 ms |
12436 KB |
Output is correct - L = 90 |
3 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
4 |
Correct |
86 ms |
12436 KB |
Output is correct - L = 90 |
5 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
6 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
7 |
Correct |
68 ms |
12436 KB |
Output is correct - L = 90 |
8 |
Correct |
92 ms |
12436 KB |
Output is correct - L = 90 |
9 |
Correct |
92 ms |
12436 KB |
Output is correct - L = 90 |
10 |
Correct |
99 ms |
12436 KB |
Output is correct - L = 90 |
11 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
12 |
Correct |
242 ms |
12436 KB |
Output is correct - L = 90 |
13 |
Correct |
78 ms |
12436 KB |
Output is correct - L = 90 |
14 |
Correct |
68 ms |
12436 KB |
Output is correct - L = 6 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
12436 KB |
Output is correct - L = 90 |
2 |
Correct |
98 ms |
12436 KB |
Output is correct - L = 90 |
3 |
Correct |
78 ms |
12436 KB |
Output is correct - L = 90 |
4 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
5 |
Correct |
78 ms |
12436 KB |
Output is correct - L = 90 |
6 |
Correct |
82 ms |
12436 KB |
Output is correct - L = 90 |
7 |
Correct |
92 ms |
12436 KB |
Output is correct - L = 90 |
8 |
Correct |
82 ms |
12436 KB |
Output is correct - L = 90 |
9 |
Correct |
81 ms |
12436 KB |
Output is correct - L = 90 |
10 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
11 |
Correct |
82 ms |
12436 KB |
Output is correct - L = 90 |
12 |
Correct |
86 ms |
12436 KB |
Output is correct - L = 90 |
13 |
Correct |
282 ms |
12436 KB |
Output is correct - L = 90 |
14 |
Correct |
99 ms |
12436 KB |
Output is correct - L = 90 |
15 |
Correct |
89 ms |
12436 KB |
Output is correct - L = 90 |
16 |
Correct |
102 ms |
12436 KB |
Output is correct - L = 90 |
17 |
Correct |
99 ms |
12436 KB |
Output is correct - L = 90 |
18 |
Correct |
115 ms |
12436 KB |
Output is correct - L = 90 |
19 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
20 |
Correct |
89 ms |
12436 KB |
Output is correct - L = 90 |
21 |
Correct |
105 ms |
12436 KB |
Output is correct - L = 90 |
22 |
Correct |
75 ms |
12436 KB |
Output is correct - L = 90 |
23 |
Correct |
68 ms |
12436 KB |
Output is correct - L = 90 |
24 |
Correct |
76 ms |
12436 KB |
Output is correct - L = 90 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
2 |
Correct |
78 ms |
12436 KB |
Output is correct - L = 90 |
3 |
Correct |
82 ms |
12436 KB |
Output is correct - L = 90 |
4 |
Correct |
75 ms |
12436 KB |
Output is correct - L = 90 |
5 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
6 |
Correct |
75 ms |
12436 KB |
Output is correct - L = 90 |
7 |
Correct |
68 ms |
12436 KB |
Output is correct - L = 90 |
8 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
9 |
Correct |
68 ms |
12436 KB |
Output is correct - L = 90 |
10 |
Correct |
82 ms |
12436 KB |
Output is correct - L = 90 |
11 |
Correct |
68 ms |
12436 KB |
Output is correct - L = 90 |
12 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
13 |
Correct |
199 ms |
12436 KB |
Output is correct - L = 90 |
14 |
Correct |
75 ms |
12436 KB |
Output is correct - L = 90 |
15 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
16 |
Correct |
106 ms |
12436 KB |
Output is correct - L = 90 |
17 |
Correct |
106 ms |
12436 KB |
Output is correct - L = 90 |
18 |
Correct |
118 ms |
12436 KB |
Output is correct - L = 90 |
19 |
Correct |
86 ms |
12436 KB |
Output is correct - L = 90 |
20 |
Correct |
95 ms |
12436 KB |
Output is correct - L = 90 |
21 |
Correct |
106 ms |
12436 KB |
Output is correct - L = 90 |
22 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
23 |
Correct |
68 ms |
12436 KB |
Output is correct - L = 90 |
24 |
Correct |
76 ms |
12436 KB |
Output is correct - L = 90 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
2 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
3 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
4 |
Correct |
76 ms |
12436 KB |
Output is correct - L = 90 |
5 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
6 |
Correct |
92 ms |
12436 KB |
Output is correct - L = 90 |
7 |
Correct |
86 ms |
12436 KB |
Output is correct - L = 90 |
8 |
Correct |
81 ms |
12436 KB |
Output is correct - L = 90 |
9 |
Correct |
68 ms |
12436 KB |
Output is correct - L = 90 |
10 |
Correct |
75 ms |
12436 KB |
Output is correct - L = 90 |
11 |
Correct |
81 ms |
12436 KB |
Output is correct - L = 90 |
12 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
13 |
Correct |
228 ms |
12436 KB |
Output is correct - L = 90 |
14 |
Correct |
82 ms |
12436 KB |
Output is correct - L = 90 |
15 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
16 |
Correct |
89 ms |
12436 KB |
Output is correct - L = 90 |
17 |
Correct |
108 ms |
12436 KB |
Output is correct - L = 90 |
18 |
Correct |
118 ms |
12436 KB |
Output is correct - L = 90 |
19 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
20 |
Correct |
102 ms |
12436 KB |
Output is correct - L = 90 |
21 |
Correct |
112 ms |
12436 KB |
Output is correct - L = 90 |
22 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
23 |
Correct |
72 ms |
12436 KB |
Output is correct - L = 90 |
24 |
Correct |
79 ms |
12436 KB |
Output is correct - L = 90 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
68 ms |
12436 KB |
Output isn't correct - L = 90 |
2 |
Incorrect |
79 ms |
12436 KB |
Output isn't correct - L = 90 |
3 |
Incorrect |
72 ms |
12436 KB |
Output isn't correct - L = 90 |
4 |
Incorrect |
76 ms |
12436 KB |
Output isn't correct - L = 90 |
5 |
Incorrect |
92 ms |
12436 KB |
Output isn't correct - L = 90 |
6 |
Incorrect |
72 ms |
12436 KB |
Output isn't correct - L = 90 |
7 |
Incorrect |
68 ms |
12436 KB |
Output isn't correct - L = 90 |
8 |
Incorrect |
81 ms |
12436 KB |
Output isn't correct - L = 90 |
9 |
Incorrect |
79 ms |
12436 KB |
Output isn't correct - L = 90 |
10 |
Incorrect |
76 ms |
12436 KB |
Output isn't correct - L = 90 |
11 |
Incorrect |
68 ms |
12436 KB |
Output isn't correct - L = 90 |
12 |
Incorrect |
79 ms |
12436 KB |
Output isn't correct - L = 90 |
13 |
Incorrect |
219 ms |
12436 KB |
Output isn't correct - L = 90 |
14 |
Incorrect |
75 ms |
12436 KB |
Output isn't correct - L = 90 |
15 |
Incorrect |
82 ms |
12436 KB |
Output isn't correct - L = 90 |
16 |
Incorrect |
92 ms |
12436 KB |
Output isn't correct - L = 90 |
17 |
Incorrect |
98 ms |
12436 KB |
Output isn't correct - L = 90 |
18 |
Incorrect |
112 ms |
12436 KB |
Output isn't correct - L = 90 |
19 |
Incorrect |
79 ms |
12436 KB |
Output isn't correct - L = 90 |
20 |
Incorrect |
102 ms |
12436 KB |
Output isn't correct - L = 90 |
21 |
Incorrect |
139 ms |
12436 KB |
Output isn't correct - L = 90 |
22 |
Incorrect |
68 ms |
12436 KB |
Output isn't correct - L = 90 |
23 |
Incorrect |
79 ms |
12436 KB |
Output isn't correct - L = 90 |
24 |
Incorrect |
78 ms |
12436 KB |
Output isn't correct - L = 90 |