# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
565093 |
2022-05-20T09:03:50 Z |
Dodo |
Saveit (IOI10_saveit) |
C++14 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
#include "decoder.h"
#define ll long long
using namespace std;
void encode(int n, int h, int p, int a[], int b[]){
map<pair<ll,ll>,bool>mp;
for(int i=0;i<p;i++)
mp[{a[i],b[i]}]=1;
for(int i=0;i<h;i++)
{
for(int j=0;j<n;j++)
{
if(mp[{i,h}]==1)encode_bit(1);
else encode_bit(0);
}
}
return;
}
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
#include "decoder.h"
#define ll long long
using namespace std;
void decode(int n, int h) {
vector<ll>v[n];
for(int i=0;i<h;i++)
{
for(int j=0;j<n;j++)
{
int a = decode_bit();
if(a==1)
{
v[i].push_back(h);
v[h].push_back(i);
}
}
}
ll arr[h][n];
for(int i=0;i<h;i++)
{
deque<ll>q;
ll vis[n]={};
vis[i]=1;
q.push_back(i);
ll cnt
while(!q.empty())
{
ll x=q.front();
q.pop_front();
for(auto u:v[x])
{
if(vis[u]==0)
{
vis[u]=vis[x]+1;
q.push_back(u);
}
}
}
for(int j=0;j<n;j++)
{
arr[i][j]=vis[j];
}
}
for(int i=0;i<h;i++)
{
for(int j=0;j<n;j++)
{
hops(i,j,arr[i][j]);
}
}
}
Compilation message
decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:32:6: error: expected initializer before 'while'
32 | while(!q.empty())
| ^~~~~