This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
#define ll long long
//#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> v[1010];
int dist[40][1010];
void bfs(int pos){
vector<bool> vis(1100,0);
queue<pair<int,int> >q;
q.push({pos,0});
while(!q.empty()){
int p=q.front().first;
int d=q.front().second;
q.pop();
if(vis[p])continue;
vis[p]=1;
dist[pos][p]=d;
for(int k:v[p])q.push({k,d+1});
}
}
void aggiungi(int k){
for(int i=9;i>=0;i--){
encode_bit((k&(1<<i))>0);
}
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
for(int i=0;i<ne;i++){
v[v1[i]].push_back(v2[i]);
v[v2[i]].push_back(v1[i]);
}
for(int i=0;i<nh;i++){
bfs(i);
}
for(int i=0;i<nh;i++){
for(int j=0;j<nv;j++){
aggiungi(dist[i][j]);
}
}
return;
}/*
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);
}*/
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;
#define ll long long
//#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int c(){
int k=0;
for(int i=9;i>=0;i--){
k+=(1<<i)*decode_bit();
}
return k;
}
void decode(int nv, int nh){
for(int i=0;i<nh;i++){
for(int j=0;j<nv;j++){
hops(i,j,c());
}
}
}
# | 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... |