# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
573190 |
2022-06-06T08:38:54 Z |
Sho10 |
Saveit (IOI10_saveit) |
C++17 |
|
0 ms |
0 KB |
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho
#include "grader.h"
#include "encoder.h"
using ll=long long;
using ld=long double;
int const INF=1000000005;
ll const LINF=1000000000000000005;
ll const mod=6700417;
ld const PI=3.14159265359;
ll const MAX_N=3e5+5;
ld const EPS=0.00000001;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(a) (int)a.size()
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
vector<ll>g[1005];
ll d[1005],ans[1005][1005];
string calc(ll x){
string res="";
for(ll i=0;i<30;i++)
{
if((1ll<<i)&x){
res+='1';
}else res+='0';
}
reverse(res.begin(),res.end());
return res;
}
void encode(int n, int h, int m, int *v1, int *v2){
for(ll i=0;i<m;i++)
{
g[v1[i]].pb(v2[i]);
g[v2[i]].pb(v1[i]);
}
for(ll i=0;i<h;i++)
{
for(ll j=0;j<=n;j++)
{
d[j]=LINF;
}
queue<ll>q;
q.push(i);
d[i]=0;
while(!q.empty()){
ll x=q.front();
ans[i][x]=d[x];
q.pop();
for(auto it : g[x]){
if(d[it]==LINF){
d[it]=d[x]+1;
q.push(it);
}
}
}
}
for(ll i=0;i<h;i++)
{
for(ll j=0;j<n;j++)
{
string s1=calc(ans[i][j]);
while(s1.size()<10){
s1=" "+s1;
}
for(auto it : s1){
encode_bit(it-'0');
}
}
}
}
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho
#include "grader.h"
#include "encoder.h"
using ll=long long;
using ld=long double;
int const INF=1000000005;
ll const LINF=1000000000000000005;
ll const mod=6700417;
ld const PI=3.14159265359;
ll const MAX_N=3e5+5;
ld const EPS=0.00000001;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(a) (int)a.size()
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll ans[1005][1005];
void decode(int n,int h){
for(ll i=0;i<h;i++)
{
for(ll j=0;j<n;j++)
{
string s="";
for(ll k=i*10;k<i*10+10;k++)
{
ll x=decode_bit(k);
s+=(x+'0');
}
}
reverse(s.begin(),s.end());
ll pw=0;
ll val=0;
for(ll i=0;i<s.size();i++)
{
if(s[i]=='1'){
val+=(1ll<<pw);
}
pw++;
}
hops(i,j,val);
}
}
Compilation message
decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:31:18: error: too many arguments to function 'int decode_bit()'
31 | ll x=decode_bit(k);
| ^
In file included from decoder.cpp:2:
grader.h:2:5: note: declared here
2 | int decode_bit();
| ^~~~~~~~~~
decoder.cpp:15:11: error: 'second' was not declared in this scope
15 | #define s second
| ^~~~~~
decoder.cpp:35:13: note: in expansion of macro 's'
35 | reverse(s.begin(),s.end());
| ^
decoder.cpp:45:12: error: 'j' was not declared in this scope
45 | hops(i,j,val);
| ^