Submission #576296

# Submission time Handle Problem Language Result Execution time Memory
576296 2022-06-13T01:30:44 Z zaneyu Saveit (IOI10_saveit) C++14
25 / 100
258 ms 13360 KB
#include "grader.h"
#include "encoder.h"

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,int>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
namespace {
vector<int> v[1005];
int dist[1005];
void send(int x){
    REP(i,10){
        encode_bit((x>>(9-i))&1);
    }
}
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
    REP(i,ne){
        v[v1[i]].pb(v2[i]);
        v[v2[i]].pb(v1[i]);
    }
    vector<pii> eds;
    REP(i,nh){
        REP(j,nv) dist[j]=1e9;
        dist[i]=0;
        queue<int> q;
        q.push(i);
        while(sz(q)){
            int z=q.front();
            q.pop();
            for(int x:v[z]){
                if(dist[x]>dist[z]+1){
                    if(x>z) eds.pb({x,z});
                    else eds.pb({z,x});
                    dist[x]=dist[z]+1;
                    q.push(x);
                }
            }
        }
    }
    SORT_UNIQUE(eds);
    send(sz(eds)/1024),send(sz(eds)%1024);
    for(auto x:eds){
        send(x.f),send(x.s);
    }
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,int>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
namespace {
int get(){
    int x=0;
    REP(i,10){
        x=x*2+decode_bit();
    }
    return x;
}
vector<int> v[1005];
int dist[1005];
}
void decode(int nv, int nh) {
    int len=get()*1024+get();
    REP(i,len){
        int a=get(),b=get();
        v[a].pb(b);
        v[b].pb(a);
    }
    REP(i,nh){
        REP(j,nv) dist[j]=1e9;
        dist[i]=0;
        queue<int> q;
        q.push(i);
        while(sz(q)){
            int z=q.front();
            q.pop();
            for(int x:v[z]){
                if(dist[x]>dist[z]+1){
                    dist[x]=dist[z]+1;
                    q.push(x);
                }
            }
        }
        REP(j,nv) hops(i,j,dist[j]); 
    }
}
# Verdict Execution time Memory Grader output
1 Correct 258 ms 13360 KB Output is partially correct - 354620 call(s) of encode_bit()
2 Correct 2 ms 4604 KB Output is correct - 160 call(s) of encode_bit()
3 Correct 30 ms 6128 KB Output is correct - 69700 call(s) of encode_bit()
4 Correct 2 ms 4612 KB Output is correct - 200 call(s) of encode_bit()
5 Correct 50 ms 7220 KB Output is partially correct - 183860 call(s) of encode_bit()
6 Correct 50 ms 7156 KB Output is partially correct - 188300 call(s) of encode_bit()
7 Correct 93 ms 8972 KB Output is partially correct - 362020 call(s) of encode_bit()
8 Correct 22 ms 6040 KB Output is correct - 36540 call(s) of encode_bit()
9 Correct 23 ms 6284 KB Output is correct - 41040 call(s) of encode_bit()
10 Correct 24 ms 6384 KB Output is correct - 38960 call(s) of encode_bit()
11 Correct 43 ms 6584 KB Output is partially correct - 94720 call(s) of encode_bit()
12 Correct 17 ms 6028 KB Output is correct - 20000 call(s) of encode_bit()
13 Correct 78 ms 8172 KB Output is partially correct - 241580 call(s) of encode_bit()
14 Correct 23 ms 6256 KB Output is correct - 45460 call(s) of encode_bit()
15 Correct 26 ms 6280 KB Output is correct - 48560 call(s) of encode_bit()
16 Correct 74 ms 6848 KB Output is partially correct - 107040 call(s) of encode_bit()
17 Correct 49 ms 6912 KB Output is partially correct - 99240 call(s) of encode_bit()
18 Correct 81 ms 7616 KB Output is partially correct - 162340 call(s) of encode_bit()
19 Correct 55 ms 7332 KB Output is partially correct - 171000 call(s) of encode_bit()
20 Correct 100 ms 8352 KB Output is partially correct - 209840 call(s) of encode_bit()
21 Correct 97 ms 8524 KB Output is partially correct - 222840 call(s) of encode_bit()
22 Correct 87 ms 8888 KB Output is partially correct - 337220 call(s) of encode_bit()
23 Correct 121 ms 9444 KB Output is partially correct - 312000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 258 ms 13360 KB Output is partially correct - 354620 call(s) of encode_bit()
2 Correct 2 ms 4604 KB Output is correct - 160 call(s) of encode_bit()
3 Correct 30 ms 6128 KB Output is correct - 69700 call(s) of encode_bit()
4 Correct 2 ms 4612 KB Output is correct - 200 call(s) of encode_bit()
5 Correct 50 ms 7220 KB Output is partially correct - 183860 call(s) of encode_bit()
6 Correct 50 ms 7156 KB Output is partially correct - 188300 call(s) of encode_bit()
7 Correct 93 ms 8972 KB Output is partially correct - 362020 call(s) of encode_bit()
8 Correct 22 ms 6040 KB Output is correct - 36540 call(s) of encode_bit()
9 Correct 23 ms 6284 KB Output is correct - 41040 call(s) of encode_bit()
10 Correct 24 ms 6384 KB Output is correct - 38960 call(s) of encode_bit()
11 Correct 43 ms 6584 KB Output is partially correct - 94720 call(s) of encode_bit()
12 Correct 17 ms 6028 KB Output is correct - 20000 call(s) of encode_bit()
13 Correct 78 ms 8172 KB Output is partially correct - 241580 call(s) of encode_bit()
14 Correct 23 ms 6256 KB Output is correct - 45460 call(s) of encode_bit()
15 Correct 26 ms 6280 KB Output is correct - 48560 call(s) of encode_bit()
16 Correct 74 ms 6848 KB Output is partially correct - 107040 call(s) of encode_bit()
17 Correct 49 ms 6912 KB Output is partially correct - 99240 call(s) of encode_bit()
18 Correct 81 ms 7616 KB Output is partially correct - 162340 call(s) of encode_bit()
19 Correct 55 ms 7332 KB Output is partially correct - 171000 call(s) of encode_bit()
20 Correct 100 ms 8352 KB Output is partially correct - 209840 call(s) of encode_bit()
21 Correct 97 ms 8524 KB Output is partially correct - 222840 call(s) of encode_bit()
22 Correct 87 ms 8888 KB Output is partially correct - 337220 call(s) of encode_bit()
23 Correct 121 ms 9444 KB Output is partially correct - 312000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 258 ms 13360 KB Output is partially correct - 354620 call(s) of encode_bit()
2 Correct 2 ms 4604 KB Output is correct - 160 call(s) of encode_bit()
3 Correct 30 ms 6128 KB Output is correct - 69700 call(s) of encode_bit()
4 Correct 2 ms 4612 KB Output is correct - 200 call(s) of encode_bit()
5 Correct 50 ms 7220 KB Output is partially correct - 183860 call(s) of encode_bit()
6 Correct 50 ms 7156 KB Output is partially correct - 188300 call(s) of encode_bit()
7 Correct 93 ms 8972 KB Output is partially correct - 362020 call(s) of encode_bit()
8 Correct 22 ms 6040 KB Output is correct - 36540 call(s) of encode_bit()
9 Correct 23 ms 6284 KB Output is correct - 41040 call(s) of encode_bit()
10 Correct 24 ms 6384 KB Output is correct - 38960 call(s) of encode_bit()
11 Correct 43 ms 6584 KB Output is partially correct - 94720 call(s) of encode_bit()
12 Correct 17 ms 6028 KB Output is correct - 20000 call(s) of encode_bit()
13 Correct 78 ms 8172 KB Output is partially correct - 241580 call(s) of encode_bit()
14 Correct 23 ms 6256 KB Output is correct - 45460 call(s) of encode_bit()
15 Correct 26 ms 6280 KB Output is correct - 48560 call(s) of encode_bit()
16 Correct 74 ms 6848 KB Output is partially correct - 107040 call(s) of encode_bit()
17 Correct 49 ms 6912 KB Output is partially correct - 99240 call(s) of encode_bit()
18 Correct 81 ms 7616 KB Output is partially correct - 162340 call(s) of encode_bit()
19 Correct 55 ms 7332 KB Output is partially correct - 171000 call(s) of encode_bit()
20 Correct 100 ms 8352 KB Output is partially correct - 209840 call(s) of encode_bit()
21 Correct 97 ms 8524 KB Output is partially correct - 222840 call(s) of encode_bit()
22 Correct 87 ms 8888 KB Output is partially correct - 337220 call(s) of encode_bit()
23 Correct 121 ms 9444 KB Output is partially correct - 312000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 258 ms 13360 KB Output is partially correct - 354620 call(s) of encode_bit()
2 Correct 2 ms 4604 KB Output is correct - 160 call(s) of encode_bit()
3 Correct 30 ms 6128 KB Output is correct - 69700 call(s) of encode_bit()
4 Correct 2 ms 4612 KB Output is correct - 200 call(s) of encode_bit()
5 Correct 50 ms 7220 KB Output is partially correct - 183860 call(s) of encode_bit()
6 Correct 50 ms 7156 KB Output is partially correct - 188300 call(s) of encode_bit()
7 Correct 93 ms 8972 KB Output is partially correct - 362020 call(s) of encode_bit()
8 Correct 22 ms 6040 KB Output is correct - 36540 call(s) of encode_bit()
9 Correct 23 ms 6284 KB Output is correct - 41040 call(s) of encode_bit()
10 Correct 24 ms 6384 KB Output is correct - 38960 call(s) of encode_bit()
11 Correct 43 ms 6584 KB Output is partially correct - 94720 call(s) of encode_bit()
12 Correct 17 ms 6028 KB Output is correct - 20000 call(s) of encode_bit()
13 Correct 78 ms 8172 KB Output is partially correct - 241580 call(s) of encode_bit()
14 Correct 23 ms 6256 KB Output is correct - 45460 call(s) of encode_bit()
15 Correct 26 ms 6280 KB Output is correct - 48560 call(s) of encode_bit()
16 Correct 74 ms 6848 KB Output is partially correct - 107040 call(s) of encode_bit()
17 Correct 49 ms 6912 KB Output is partially correct - 99240 call(s) of encode_bit()
18 Correct 81 ms 7616 KB Output is partially correct - 162340 call(s) of encode_bit()
19 Correct 55 ms 7332 KB Output is partially correct - 171000 call(s) of encode_bit()
20 Correct 100 ms 8352 KB Output is partially correct - 209840 call(s) of encode_bit()
21 Correct 97 ms 8524 KB Output is partially correct - 222840 call(s) of encode_bit()
22 Correct 87 ms 8888 KB Output is partially correct - 337220 call(s) of encode_bit()
23 Correct 121 ms 9444 KB Output is partially correct - 312000 call(s) of encode_bit()