Submission #1090131

# Submission time Handle Problem Language Result Execution time Memory
1090131 2024-09-17T19:09:13 Z Tymond Saveit (IOI10_saveit) C++17
0 / 100
10000 ms 262144 KB
#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define fi first
#define se second
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
inline int rand(int l,int r){return uniform_int_distribution<int>(l, r)(rng);}
inline ll rand(ll l,ll r){return uniform_int_distribution<ll>(l, r)(rng64);}
#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int MAXN = 1e3 + 7;
const int MAXH = 40;
int dist[MAXH][MAXN];
vi g[MAXN];
int n, h, m;

void countDist(int start){
    dist[start][start] = 0;
    queue<int> q;
    q.push(start);
    while(sz(q)){
        int v = q.front();
        q.pop();

        for(auto u : g[v]){
            if(u == start){
                continue;
            }
            if(dist[start][u] < dist[start][v] + 1){
                dist[start][u] = dist[start][v] + 1;
                q.push(u);
            }
        }
    }
}

void encode(int nv, int nh, int ne, int *v1, int *v2){
    n = nv;
    h = nh;
    m = ne;
    for(int i = 0; i < m; i++){
        g[v1[i]].pb(v2[i]);
        g[v2[i]].pb(v1[i]);
    }

    for(int i = 0; i < h; i++){
        countDist(i);
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < n; j++){
            for(int y = 0; y < 10; y++){
                if(dist[i][j] & (1 << y)){
                    encode_bit(1);
                }else{
                    encode_bit(0);
                }
            }
        }
    }
    return;
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define fi first
#define se second
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
inline int rand(int l,int r){return uniform_int_distribution<int>(l, r)(rng);}
inline ll rand(ll l,ll r){return uniform_int_distribution<ll>(l, r)(rng64);}
#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int MAXN = 1e3 + 7;
const int MAXH = 40;
int dist[MAXH][MAXN];
int n, h;

void decode(int nv, int nh) {
    n = nv;
    h = nh;

    for(int i = 0; i < h; i++){
        for(int j = 0; j < n; j++){
            for(int y = 0; y < 10; y++){
                int a = decode_bit();
                dist[i][j] += (a * (1 << y));
            }
            hops(j, i, dist[j][i]);
        }
    }
    return;
}
# Verdict Execution time Memory Grader output
1 Runtime error 462 ms 262144 KB Execution killed with signal 9
2 Execution timed out 10056 ms 344 KB Time limit exceeded
3 Runtime error 1064 ms 262144 KB Execution killed with signal 9
4 Runtime error 783 ms 262144 KB Execution killed with signal 9
5 Runtime error 711 ms 262144 KB Execution killed with signal 9
6 Runtime error 722 ms 262144 KB Execution killed with signal 9
7 Runtime error 587 ms 262144 KB Execution killed with signal 9
8 Execution timed out 10043 ms 852 KB Time limit exceeded
9 Runtime error 381 ms 262144 KB Execution killed with signal 9
10 Runtime error 389 ms 262144 KB Execution killed with signal 9
11 Runtime error 374 ms 262144 KB Execution killed with signal 9
12 Execution timed out 10067 ms 600 KB Time limit exceeded
13 Runtime error 547 ms 262144 KB Execution killed with signal 9
14 Runtime error 278 ms 262144 KB Execution killed with signal 9
15 Runtime error 210 ms 262144 KB Execution killed with signal 9
16 Runtime error 249 ms 262144 KB Execution killed with signal 9
17 Runtime error 320 ms 262144 KB Execution killed with signal 9
18 Runtime error 448 ms 262144 KB Execution killed with signal 9
19 Runtime error 526 ms 262144 KB Execution killed with signal 9
20 Runtime error 497 ms 262144 KB Execution killed with signal 9
21 Runtime error 476 ms 262144 KB Execution killed with signal 9
22 Runtime error 568 ms 262144 KB Execution killed with signal 9
23 Runtime error 572 ms 262144 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Runtime error 462 ms 262144 KB Execution killed with signal 9
2 Execution timed out 10056 ms 344 KB Time limit exceeded
3 Runtime error 1064 ms 262144 KB Execution killed with signal 9
4 Runtime error 783 ms 262144 KB Execution killed with signal 9
5 Runtime error 711 ms 262144 KB Execution killed with signal 9
6 Runtime error 722 ms 262144 KB Execution killed with signal 9
7 Runtime error 587 ms 262144 KB Execution killed with signal 9
8 Execution timed out 10043 ms 852 KB Time limit exceeded
9 Runtime error 381 ms 262144 KB Execution killed with signal 9
10 Runtime error 389 ms 262144 KB Execution killed with signal 9
11 Runtime error 374 ms 262144 KB Execution killed with signal 9
12 Execution timed out 10067 ms 600 KB Time limit exceeded
13 Runtime error 547 ms 262144 KB Execution killed with signal 9
14 Runtime error 278 ms 262144 KB Execution killed with signal 9
15 Runtime error 210 ms 262144 KB Execution killed with signal 9
16 Runtime error 249 ms 262144 KB Execution killed with signal 9
17 Runtime error 320 ms 262144 KB Execution killed with signal 9
18 Runtime error 448 ms 262144 KB Execution killed with signal 9
19 Runtime error 526 ms 262144 KB Execution killed with signal 9
20 Runtime error 497 ms 262144 KB Execution killed with signal 9
21 Runtime error 476 ms 262144 KB Execution killed with signal 9
22 Runtime error 568 ms 262144 KB Execution killed with signal 9
23 Runtime error 572 ms 262144 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Runtime error 462 ms 262144 KB Execution killed with signal 9
2 Execution timed out 10056 ms 344 KB Time limit exceeded
3 Runtime error 1064 ms 262144 KB Execution killed with signal 9
4 Runtime error 783 ms 262144 KB Execution killed with signal 9
5 Runtime error 711 ms 262144 KB Execution killed with signal 9
6 Runtime error 722 ms 262144 KB Execution killed with signal 9
7 Runtime error 587 ms 262144 KB Execution killed with signal 9
8 Execution timed out 10043 ms 852 KB Time limit exceeded
9 Runtime error 381 ms 262144 KB Execution killed with signal 9
10 Runtime error 389 ms 262144 KB Execution killed with signal 9
11 Runtime error 374 ms 262144 KB Execution killed with signal 9
12 Execution timed out 10067 ms 600 KB Time limit exceeded
13 Runtime error 547 ms 262144 KB Execution killed with signal 9
14 Runtime error 278 ms 262144 KB Execution killed with signal 9
15 Runtime error 210 ms 262144 KB Execution killed with signal 9
16 Runtime error 249 ms 262144 KB Execution killed with signal 9
17 Runtime error 320 ms 262144 KB Execution killed with signal 9
18 Runtime error 448 ms 262144 KB Execution killed with signal 9
19 Runtime error 526 ms 262144 KB Execution killed with signal 9
20 Runtime error 497 ms 262144 KB Execution killed with signal 9
21 Runtime error 476 ms 262144 KB Execution killed with signal 9
22 Runtime error 568 ms 262144 KB Execution killed with signal 9
23 Runtime error 572 ms 262144 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Runtime error 462 ms 262144 KB Execution killed with signal 9
2 Execution timed out 10056 ms 344 KB Time limit exceeded
3 Runtime error 1064 ms 262144 KB Execution killed with signal 9
4 Runtime error 783 ms 262144 KB Execution killed with signal 9
5 Runtime error 711 ms 262144 KB Execution killed with signal 9
6 Runtime error 722 ms 262144 KB Execution killed with signal 9
7 Runtime error 587 ms 262144 KB Execution killed with signal 9
8 Execution timed out 10043 ms 852 KB Time limit exceeded
9 Runtime error 381 ms 262144 KB Execution killed with signal 9
10 Runtime error 389 ms 262144 KB Execution killed with signal 9
11 Runtime error 374 ms 262144 KB Execution killed with signal 9
12 Execution timed out 10067 ms 600 KB Time limit exceeded
13 Runtime error 547 ms 262144 KB Execution killed with signal 9
14 Runtime error 278 ms 262144 KB Execution killed with signal 9
15 Runtime error 210 ms 262144 KB Execution killed with signal 9
16 Runtime error 249 ms 262144 KB Execution killed with signal 9
17 Runtime error 320 ms 262144 KB Execution killed with signal 9
18 Runtime error 448 ms 262144 KB Execution killed with signal 9
19 Runtime error 526 ms 262144 KB Execution killed with signal 9
20 Runtime error 497 ms 262144 KB Execution killed with signal 9
21 Runtime error 476 ms 262144 KB Execution killed with signal 9
22 Runtime error 568 ms 262144 KB Execution killed with signal 9
23 Runtime error 572 ms 262144 KB Execution killed with signal 9