답안 #271190

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
271190 2020-08-18T05:02:23 Z 최은수(#5096) 저장 (Saveit) (IOI10_saveit) C++14
0 / 100
508 ms 11240 KB
#include"grader.h"
#include"encoder.h"
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
static vector<int>adj[1010];
static vector<int>make(int n,int sc)
{
    vector<bool>chk(n,0);
    vector<int>pa(n,0);
    chk[sc]=1;
    pa[sc]=0;
    queue<int>q;
    q.ep(sc);
    while(!q.empty())
    {
        int x=q.front();
        q.pop();
        for(int&t:adj[x])
            if(!chk[t])
                chk[t]=1,pa[t]=x,q.ep(t);
    }
    return pa;
}
static vector<int>calc(int n,int sc)
{
    vector<bool>chk(n,0);
    vector<int>dis(n,0);
    chk[sc]=1;
    dis[sc]=0;
    queue<int>q;
    q.ep(sc);
    while(!q.empty())
    {
        int x=q.front();
        q.pop();
        for(int&t:adj[x])
            if(!chk[t])
                chk[t]=1,dis[t]=dis[x]+1,q.ep(t);
    }
    return dis;
}
void encode(int nv,int nh,int ne,int*v1,int*v2)
{
    for(int i=0;i<ne;i++)
        adj[v1[i]].eb(v2[i]),adj[v2[i]].eb(v1[i]);
    vector<int>pa=make(nv,0);
    for(int i=1;i<nv;i++)
        for(int j=0;j<10;j++)
            encode_bit(pa[i]>>j&1);
    for(int i=0;i<nh;i++)
    {
        vector<int>d=calc(nv,i);
        vector<int>w(nv,0);
        for(int i=1;i<nv;i++)
            w[i]=d[i]-d[pa[i]];
        for(int i=0;i<nv;i+=5)
        {
            int val=0;
            for(int j=0,p=1;j<5&&i+j<nv;j++,p*=3)
                val+=(w[j]+1)*p;
            for(int j=0;j<8;j++)
                encode_bit(val>>j&1);
        }
    }
    return;
}
#include"grader.h"
#include"decoder.h"
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
static int w[1010];
static vector<int>adj[1010];
static int dep[1010];
static bool chk[1010];
static void dfs(int x)
{
    chk[x]=1;
    for(int&t:adj[x])
        if(!chk[t])
            dep[t]=dep[x]+w[t],dfs(t);
    return;
}
void decode(int nv,int nh)
{
    for(int i=1;i<nv;i++)
    {
        int p=0;
        for(int j=0;j<10;j++)
            p|=decode_bit()<<j;
        adj[p].eb(i);
    }
    for(int sc=0;sc<nh;sc++)
    {
        for(int i=0;i<nv;i+=5)
        {
            int val=0;
            for(int j=0;j<8;j++)
                val|=decode_bit()<<j;
            for(int j=0;j<5&&i+j<nv;j++)
                w[j]=val%3-1,val/=3;
        }
        dep[0]=0;
        fill(chk,chk+nv,0);
        dfs(0);
        for(int i=0;i<nv;i++)
            hops(sc,i,dep[i]-dep[sc]);
    }
    return;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 508 ms 11240 KB Output isn't correct
2 Correct 4 ms 4736 KB Output is correct - 64 call(s) of encode_bit()
3 Incorrect 23 ms 5504 KB wrong parameter
4 Correct 4 ms 4736 KB Output is correct - 80 call(s) of encode_bit()
5 Incorrect 35 ms 5632 KB wrong parameter
6 Incorrect 30 ms 5572 KB wrong parameter
7 Incorrect 57 ms 6036 KB wrong parameter
8 Incorrect 27 ms 5388 KB wrong parameter
9 Incorrect 26 ms 5512 KB wrong parameter
10 Incorrect 37 ms 5504 KB Output isn't correct
11 Incorrect 28 ms 5760 KB wrong parameter
12 Incorrect 27 ms 5504 KB Output isn't correct
13 Incorrect 69 ms 6180 KB wrong parameter
14 Incorrect 26 ms 5504 KB wrong parameter
15 Incorrect 32 ms 5548 KB wrong parameter
16 Incorrect 50 ms 6008 KB wrong parameter
17 Incorrect 36 ms 5932 KB wrong parameter
18 Incorrect 59 ms 6316 KB wrong parameter
19 Incorrect 32 ms 5760 KB wrong parameter
20 Incorrect 74 ms 6520 KB wrong parameter
21 Incorrect 68 ms 6648 KB wrong parameter
22 Incorrect 53 ms 6200 KB wrong parameter
23 Incorrect 102 ms 7184 KB wrong parameter
# 결과 실행 시간 메모리 Grader output
1 Incorrect 508 ms 11240 KB Output isn't correct
2 Correct 4 ms 4736 KB Output is correct - 64 call(s) of encode_bit()
3 Incorrect 23 ms 5504 KB wrong parameter
4 Correct 4 ms 4736 KB Output is correct - 80 call(s) of encode_bit()
5 Incorrect 35 ms 5632 KB wrong parameter
6 Incorrect 30 ms 5572 KB wrong parameter
7 Incorrect 57 ms 6036 KB wrong parameter
8 Incorrect 27 ms 5388 KB wrong parameter
9 Incorrect 26 ms 5512 KB wrong parameter
10 Incorrect 37 ms 5504 KB Output isn't correct
11 Incorrect 28 ms 5760 KB wrong parameter
12 Incorrect 27 ms 5504 KB Output isn't correct
13 Incorrect 69 ms 6180 KB wrong parameter
14 Incorrect 26 ms 5504 KB wrong parameter
15 Incorrect 32 ms 5548 KB wrong parameter
16 Incorrect 50 ms 6008 KB wrong parameter
17 Incorrect 36 ms 5932 KB wrong parameter
18 Incorrect 59 ms 6316 KB wrong parameter
19 Incorrect 32 ms 5760 KB wrong parameter
20 Incorrect 74 ms 6520 KB wrong parameter
21 Incorrect 68 ms 6648 KB wrong parameter
22 Incorrect 53 ms 6200 KB wrong parameter
23 Incorrect 102 ms 7184 KB wrong parameter
# 결과 실행 시간 메모리 Grader output
1 Incorrect 508 ms 11240 KB Output isn't correct
2 Correct 4 ms 4736 KB Output is correct - 64 call(s) of encode_bit()
3 Incorrect 23 ms 5504 KB wrong parameter
4 Correct 4 ms 4736 KB Output is correct - 80 call(s) of encode_bit()
5 Incorrect 35 ms 5632 KB wrong parameter
6 Incorrect 30 ms 5572 KB wrong parameter
7 Incorrect 57 ms 6036 KB wrong parameter
8 Incorrect 27 ms 5388 KB wrong parameter
9 Incorrect 26 ms 5512 KB wrong parameter
10 Incorrect 37 ms 5504 KB Output isn't correct
11 Incorrect 28 ms 5760 KB wrong parameter
12 Incorrect 27 ms 5504 KB Output isn't correct
13 Incorrect 69 ms 6180 KB wrong parameter
14 Incorrect 26 ms 5504 KB wrong parameter
15 Incorrect 32 ms 5548 KB wrong parameter
16 Incorrect 50 ms 6008 KB wrong parameter
17 Incorrect 36 ms 5932 KB wrong parameter
18 Incorrect 59 ms 6316 KB wrong parameter
19 Incorrect 32 ms 5760 KB wrong parameter
20 Incorrect 74 ms 6520 KB wrong parameter
21 Incorrect 68 ms 6648 KB wrong parameter
22 Incorrect 53 ms 6200 KB wrong parameter
23 Incorrect 102 ms 7184 KB wrong parameter
# 결과 실행 시간 메모리 Grader output
1 Incorrect 508 ms 11240 KB Output isn't correct
2 Correct 4 ms 4736 KB Output is correct - 64 call(s) of encode_bit()
3 Incorrect 23 ms 5504 KB wrong parameter
4 Correct 4 ms 4736 KB Output is correct - 80 call(s) of encode_bit()
5 Incorrect 35 ms 5632 KB wrong parameter
6 Incorrect 30 ms 5572 KB wrong parameter
7 Incorrect 57 ms 6036 KB wrong parameter
8 Incorrect 27 ms 5388 KB wrong parameter
9 Incorrect 26 ms 5512 KB wrong parameter
10 Incorrect 37 ms 5504 KB Output isn't correct
11 Incorrect 28 ms 5760 KB wrong parameter
12 Incorrect 27 ms 5504 KB Output isn't correct
13 Incorrect 69 ms 6180 KB wrong parameter
14 Incorrect 26 ms 5504 KB wrong parameter
15 Incorrect 32 ms 5548 KB wrong parameter
16 Incorrect 50 ms 6008 KB wrong parameter
17 Incorrect 36 ms 5932 KB wrong parameter
18 Incorrect 59 ms 6316 KB wrong parameter
19 Incorrect 32 ms 5760 KB wrong parameter
20 Incorrect 74 ms 6520 KB wrong parameter
21 Incorrect 68 ms 6648 KB wrong parameter
22 Incorrect 53 ms 6200 KB wrong parameter
23 Incorrect 102 ms 7184 KB wrong parameter