# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
6988 | gs13068 | Saveit (IOI10_saveit) | C++98 | 336 ms | 14100 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "grader.h"
#include "encoder.h"
#include <vector>
static std::vector<int> G[1000];
static int P[1000];
static int Q[1000],QN;
static int D[1000];
static void send(int x,int y){while(x--)encode_bit((y>>x)&1);}
void encode(int N, int H, int E, int A[], int B[])
{
int i,j,k,t;
for(i=0;i<N;i++)G[i].clear();
for(i=0;i<E;i++)
{
G[A[i]].push_back(B[i]);
G[B[i]].push_back(A[i]);
}
QN=0;
for(j=0;j<N;j++)P[j]=-1;
Q[QN++]=0;
P[0]=0;
for(j=0;j<N;j++)for(k=0;k<G[Q[j]].size();k++)if(P[G[Q[j]][k]]<0)
{
Q[QN++]=G[Q[j]][k];
P[G[Q[j]][k]]=Q[j];
}
for(j=0;j<N;j++)send(10,P[j]);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |