# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
784394 |
2023-07-16T05:27:33 Z |
irmuun |
Saveit (IOI10_saveit) |
C++17 |
|
0 ms |
0 KB |
#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
void encode(int H,int N,int P,int *A,int *B){
vector<int>adj[N];
for(int i=0;i<P;i++){
adj[A[i]].pb(B[i]);
adj[B[i]].pb(A[i]);
}
int d[N];
for(int i=0;i<H;i++){
fill(d,d+N,-1);
queue<int>q;
d[i]=0;
q.push(i);
while(!q.empty()){
int x=q.top();
for(auto y:adj[x]){
if(d[y]==-1){
d[y]=d[x]+1;
q.push(y);
}
}
}
for(int j=0;j<N;j++){
for(int k=0;k<10;k++){
encode_bit(d[j]%2);
d[j]/=2;
}
}
}
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
void decode(int H,int N){
for(int i=0;i<H;i++){
for(int j=0;j<N;j++){
int ans=0;
for(int k=0;k<10;k++){
ans+=decode_bit()*(1<<k);
}
hops(i,j,ans);
}
}
}
Compilation message
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:26:21: error: 'class std::queue<int>' has no member named 'top'; did you mean 'pop'?
26 | int x=q.top();
| ^~~
| pop