# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1090141 |
2024-09-17T19:31:58 Z |
Tymond |
Saveit (IOI10_saveit) |
C++17 |
|
184 ms |
12740 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];
int lg[2 * 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] == 0){
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);
}
lg[1] = 1;
for(int i = 2; i < 2 * MAXN; i++){
lg[i] = lg[i / 2] + 1;
}
for(int i = 0; i < h; i++){
for(int j = 0; j < n; j++){
int l = 10;
for(int y = 0; y < i; y++){
l = min(l, lg[dist[y][i] + dist[y][j]]);
}
for(int y = 0; y < l; y++){
if(dist[i][j] & (1 << y)){
encode_bit(1);
}else{
encode_bit(0);
}
}
}
}
for(int i = 0; i < m; i++){
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 lg[2 * MAXN];
int n, h;
void decode(int nv, int nh) {
n = nv;
h = nh;
lg[1] = 1;
for(int i = 2; i < 2 * MAXN; i++){
lg[i] = lg[i / 2] + 1;
}
for(int i = 0; i < h; i++){
for(int j = 0; j < n; j++){
int l = 10;
for(int y = 0; y < i; y++){
l = min(l, lg[dist[y][i] + dist[y][j]]);
}
for(int y = 0; y < l; y++){
int a = decode_bit();
dist[i][j] += (a * (1 << y));
}
hops(i, j, dist[i][j]);
}
}
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
184 ms |
12740 KB |
Output is partially correct - 330970 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4620 KB |
Output is correct - 74 call(s) of encode_bit() |
3 |
Correct |
24 ms |
5884 KB |
Output is partially correct - 106295 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4632 KB |
Output is correct - 90 call(s) of encode_bit() |
5 |
Correct |
19 ms |
6160 KB |
Output is partially correct - 103263 call(s) of encode_bit() |
6 |
Correct |
19 ms |
6416 KB |
Output is partially correct - 116905 call(s) of encode_bit() |
7 |
Correct |
28 ms |
6652 KB |
Output is partially correct - 118678 call(s) of encode_bit() |
8 |
Correct |
33 ms |
6356 KB |
Output is partially correct - 175690 call(s) of encode_bit() |
9 |
Correct |
35 ms |
7340 KB |
Output is partially correct - 248357 call(s) of encode_bit() |
10 |
Correct |
37 ms |
7340 KB |
Output is partially correct - 247038 call(s) of encode_bit() |
11 |
Correct |
31 ms |
6924 KB |
Output is partially correct - 208956 call(s) of encode_bit() |
12 |
Correct |
48 ms |
7688 KB |
Output is partially correct - 310399 call(s) of encode_bit() |
13 |
Correct |
61 ms |
7344 KB |
Output is partially correct - 191977 call(s) of encode_bit() |
14 |
Correct |
35 ms |
7424 KB |
Output is partially correct - 256412 call(s) of encode_bit() |
15 |
Correct |
48 ms |
7352 KB |
Output is partially correct - 273034 call(s) of encode_bit() |
16 |
Correct |
54 ms |
8420 KB |
Output is partially correct - 260174 call(s) of encode_bit() |
17 |
Correct |
44 ms |
7548 KB |
Output is partially correct - 245198 call(s) of encode_bit() |
18 |
Correct |
48 ms |
7716 KB |
Output is partially correct - 195518 call(s) of encode_bit() |
19 |
Correct |
35 ms |
6828 KB |
Output is partially correct - 169866 call(s) of encode_bit() |
20 |
Correct |
53 ms |
7764 KB |
Output is partially correct - 192489 call(s) of encode_bit() |
21 |
Correct |
69 ms |
7796 KB |
Output is partially correct - 189013 call(s) of encode_bit() |
22 |
Correct |
41 ms |
7016 KB |
Output is partially correct - 130220 call(s) of encode_bit() |
23 |
Correct |
56 ms |
7708 KB |
Output is partially correct - 162994 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
184 ms |
12740 KB |
Output is partially correct - 330970 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4620 KB |
Output is correct - 74 call(s) of encode_bit() |
3 |
Correct |
24 ms |
5884 KB |
Output is partially correct - 106295 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4632 KB |
Output is correct - 90 call(s) of encode_bit() |
5 |
Correct |
19 ms |
6160 KB |
Output is partially correct - 103263 call(s) of encode_bit() |
6 |
Correct |
19 ms |
6416 KB |
Output is partially correct - 116905 call(s) of encode_bit() |
7 |
Correct |
28 ms |
6652 KB |
Output is partially correct - 118678 call(s) of encode_bit() |
8 |
Correct |
33 ms |
6356 KB |
Output is partially correct - 175690 call(s) of encode_bit() |
9 |
Correct |
35 ms |
7340 KB |
Output is partially correct - 248357 call(s) of encode_bit() |
10 |
Correct |
37 ms |
7340 KB |
Output is partially correct - 247038 call(s) of encode_bit() |
11 |
Correct |
31 ms |
6924 KB |
Output is partially correct - 208956 call(s) of encode_bit() |
12 |
Correct |
48 ms |
7688 KB |
Output is partially correct - 310399 call(s) of encode_bit() |
13 |
Correct |
61 ms |
7344 KB |
Output is partially correct - 191977 call(s) of encode_bit() |
14 |
Correct |
35 ms |
7424 KB |
Output is partially correct - 256412 call(s) of encode_bit() |
15 |
Correct |
48 ms |
7352 KB |
Output is partially correct - 273034 call(s) of encode_bit() |
16 |
Correct |
54 ms |
8420 KB |
Output is partially correct - 260174 call(s) of encode_bit() |
17 |
Correct |
44 ms |
7548 KB |
Output is partially correct - 245198 call(s) of encode_bit() |
18 |
Correct |
48 ms |
7716 KB |
Output is partially correct - 195518 call(s) of encode_bit() |
19 |
Correct |
35 ms |
6828 KB |
Output is partially correct - 169866 call(s) of encode_bit() |
20 |
Correct |
53 ms |
7764 KB |
Output is partially correct - 192489 call(s) of encode_bit() |
21 |
Correct |
69 ms |
7796 KB |
Output is partially correct - 189013 call(s) of encode_bit() |
22 |
Correct |
41 ms |
7016 KB |
Output is partially correct - 130220 call(s) of encode_bit() |
23 |
Correct |
56 ms |
7708 KB |
Output is partially correct - 162994 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
184 ms |
12740 KB |
Output is partially correct - 330970 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4620 KB |
Output is correct - 74 call(s) of encode_bit() |
3 |
Correct |
24 ms |
5884 KB |
Output is partially correct - 106295 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4632 KB |
Output is correct - 90 call(s) of encode_bit() |
5 |
Correct |
19 ms |
6160 KB |
Output is partially correct - 103263 call(s) of encode_bit() |
6 |
Correct |
19 ms |
6416 KB |
Output is partially correct - 116905 call(s) of encode_bit() |
7 |
Correct |
28 ms |
6652 KB |
Output is partially correct - 118678 call(s) of encode_bit() |
8 |
Correct |
33 ms |
6356 KB |
Output is partially correct - 175690 call(s) of encode_bit() |
9 |
Correct |
35 ms |
7340 KB |
Output is partially correct - 248357 call(s) of encode_bit() |
10 |
Correct |
37 ms |
7340 KB |
Output is partially correct - 247038 call(s) of encode_bit() |
11 |
Correct |
31 ms |
6924 KB |
Output is partially correct - 208956 call(s) of encode_bit() |
12 |
Correct |
48 ms |
7688 KB |
Output is partially correct - 310399 call(s) of encode_bit() |
13 |
Correct |
61 ms |
7344 KB |
Output is partially correct - 191977 call(s) of encode_bit() |
14 |
Correct |
35 ms |
7424 KB |
Output is partially correct - 256412 call(s) of encode_bit() |
15 |
Correct |
48 ms |
7352 KB |
Output is partially correct - 273034 call(s) of encode_bit() |
16 |
Correct |
54 ms |
8420 KB |
Output is partially correct - 260174 call(s) of encode_bit() |
17 |
Correct |
44 ms |
7548 KB |
Output is partially correct - 245198 call(s) of encode_bit() |
18 |
Correct |
48 ms |
7716 KB |
Output is partially correct - 195518 call(s) of encode_bit() |
19 |
Correct |
35 ms |
6828 KB |
Output is partially correct - 169866 call(s) of encode_bit() |
20 |
Correct |
53 ms |
7764 KB |
Output is partially correct - 192489 call(s) of encode_bit() |
21 |
Correct |
69 ms |
7796 KB |
Output is partially correct - 189013 call(s) of encode_bit() |
22 |
Correct |
41 ms |
7016 KB |
Output is partially correct - 130220 call(s) of encode_bit() |
23 |
Correct |
56 ms |
7708 KB |
Output is partially correct - 162994 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
184 ms |
12740 KB |
Output is partially correct - 330970 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4620 KB |
Output is correct - 74 call(s) of encode_bit() |
3 |
Correct |
24 ms |
5884 KB |
Output is partially correct - 106295 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4632 KB |
Output is correct - 90 call(s) of encode_bit() |
5 |
Correct |
19 ms |
6160 KB |
Output is partially correct - 103263 call(s) of encode_bit() |
6 |
Correct |
19 ms |
6416 KB |
Output is partially correct - 116905 call(s) of encode_bit() |
7 |
Correct |
28 ms |
6652 KB |
Output is partially correct - 118678 call(s) of encode_bit() |
8 |
Correct |
33 ms |
6356 KB |
Output is partially correct - 175690 call(s) of encode_bit() |
9 |
Correct |
35 ms |
7340 KB |
Output is partially correct - 248357 call(s) of encode_bit() |
10 |
Correct |
37 ms |
7340 KB |
Output is partially correct - 247038 call(s) of encode_bit() |
11 |
Correct |
31 ms |
6924 KB |
Output is partially correct - 208956 call(s) of encode_bit() |
12 |
Correct |
48 ms |
7688 KB |
Output is partially correct - 310399 call(s) of encode_bit() |
13 |
Correct |
61 ms |
7344 KB |
Output is partially correct - 191977 call(s) of encode_bit() |
14 |
Correct |
35 ms |
7424 KB |
Output is partially correct - 256412 call(s) of encode_bit() |
15 |
Correct |
48 ms |
7352 KB |
Output is partially correct - 273034 call(s) of encode_bit() |
16 |
Correct |
54 ms |
8420 KB |
Output is partially correct - 260174 call(s) of encode_bit() |
17 |
Correct |
44 ms |
7548 KB |
Output is partially correct - 245198 call(s) of encode_bit() |
18 |
Correct |
48 ms |
7716 KB |
Output is partially correct - 195518 call(s) of encode_bit() |
19 |
Correct |
35 ms |
6828 KB |
Output is partially correct - 169866 call(s) of encode_bit() |
20 |
Correct |
53 ms |
7764 KB |
Output is partially correct - 192489 call(s) of encode_bit() |
21 |
Correct |
69 ms |
7796 KB |
Output is partially correct - 189013 call(s) of encode_bit() |
22 |
Correct |
41 ms |
7016 KB |
Output is partially correct - 130220 call(s) of encode_bit() |
23 |
Correct |
56 ms |
7708 KB |
Output is partially correct - 162994 call(s) of encode_bit() |