Submission #520216

# Submission time Handle Problem Language Result Execution time Memory
520216 2022-01-28T21:37:23 Z new_acc Saveit (IOI10_saveit) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
#define fi first
#define se second
#define rep(a, b) for(int a = 0; a < (b); a++)
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<ll> vl;
const int N=1e3+10;
vi graf[N];
int odl[N],oj[N];
int s[N];
bool vis[N];
void dfs(int v,int o){
	vis[v]=1;
	oj[v]=o;
	for(auto u:graf[v]){
		if(vis[u]) continue;
		dfs(u,v);	
	}
}
void bfs(int x,int n){
	rep(i,n) odl[i]=-1;
	deque<int> deq;
	odl[x]=0;
	deq.push_back(x);
	while(!deq.empty()){
		int v=deq.front();
		deq.pop_front();
		for(auto u:graf[v]) if(odl[u]==-1) deq.push_back(u),odl[u]=odl[v]+1;
	}
}
void encode(int n,int h,int p,int a[],int b[]){
	rep(i,p) graf[a[i]].push_back(b[i]),graf[b[i]].push_back(a[i]);
	dfs(0,0);
	rep(i,n){
		rep(j,10){
			if(oj[i]&(1<<j)) encode_bit(1);
			else encode_bit(0);
		}
	}
	rep(i,h){
		bfs(i,n);
		rep(j,n){
			if(odl[j]==odl[oj[j]]+1) encode_bit(0),encode_bit(0);
			if(odl[j]==odl[oj[j]]) encode_bit(0),encode_bit(1);
			if(odl[j]+1==odl[oj[j]]) encode_bit(1),encode_bit(1);
		}
	}
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
#define fi first
#define se second
#define rep(a, b) for(int a = 0; a < (b); a++)
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<ll> vl;
const int N=1e3+10;
vi graf[N];
int odl[N],oj[N];
int s[N];
void decode(int n,int h){
	rep(i,n) graf[i].clear();
	rep(i,n){
		int x=0;
		rep(j,10){
			int xd=decode_bit();
			if(xd==1) x+=(1<<j);
		}
		graf[i].push_back(x),graf[x].push_back(i);
		oj[i]=x;
	}
	rep(i,h){
		deque<int> deq;
		deq.push_back(i);
		rep(j,n) vis[j]=0;
		odl[i]=0,vis[i]=1;
		rep(j,n){
			bool xd=decode_bit(),xd2=decode_bit();
			if(!xd and !xd2) s[j]=3;
			if(!xd and xd2) s[j]=1;
			if(xd and xd2) s[j]=0;
		}
		while(!deq.empty()){
			int v=deq.front();
			deq.pop_front();
			if(vis[oj[v]]){
				if(s[v]==3) odl[v]=odl[oj[v]]+1;
				if(s[v]==1) odl[v]=odl[oj[v]];
				if(s[v]==0) odl[v]=odl[oj[v]]-1;
			}else{
				if(s[v]==3) odl[oj[v]]=odl[v]-1;
				if(s[v]==1) odl[oj[v]]=odl[v];
				if(s[v]==0) odl[oj[v]]=odl[v]+1;
			}
			for(auto u:graf[v]) if(!vis[u]) deq.push_back(u),vis[u]=1;
		}
		rep(j,n) hops(i,j,odl[j]);
	}
}

Compilation message

decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:29:12: error: 'vis' was not declared in this scope; did you mean 'vi'?
   29 |   rep(j,n) vis[j]=0;
      |            ^~~
      |            vi
decoder.cpp:30:12: error: 'vis' was not declared in this scope; did you mean 'vi'?
   30 |   odl[i]=0,vis[i]=1;
      |            ^~~
      |            vi