Submission #476466

# Submission time Handle Problem Language Result Execution time Memory
476466 2021-09-27T09:30:09 Z AdamGS Saveit (IOI10_saveit) C++14
Compilation error
0 ms 0 KB
#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
void encode(int n, int h, int m, vector<int>a, vector<int>b) {
	vector<pair<int,int>>V[n];
	int uzyte[m], odl[n];
	rep(i, m) {
		uzyte[i]=0;
		V[a[i]].pb({b[i], i});
		V[b[i]].pb({a[i], i});
	}
	rep(i, h) {
		rep(j, n) odl[j]=1000000007;
		queue<int>q;
		q.push(i);
		odl[i]=0;
		while(!q.empty()) {
			int p=q.front(); q.pop();
			for(auto j : V[p]) if(odl[j.st]>odl[p]+1) {
				odl[j.st]=odl[p]+1;
				q.push(j.st);
				uzyte[j.nd]=1;
			}
		}
	}
	vector<int>T[n];
	rep(i, m) if(uzyte[i]) {
		T[a[i]].pb(b[i]);
		T[b[i]].pb(a[i]);
	}
	rep(i, h) rep(j, 10) encode_bit(p[i]&(1<<j));
	rep(i, n) {
		rep(j, 10) encode_bit(T[i].size()&(1<<j));
		for(auto j : T[i]) {
			rep(l, 10) encode_bit(j&(1<<l));
		}
	}
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
void decode(int n, int h) {
	vector<int>V[n];
	rep(i, n) {
		int a=0;
		rep(j, 10) a+=decode_bit()*(1<<j);
		rep(j, a) {
			int x=0;
			rep(l, 10) x+=decode_bit()*(1<<l);
			V[i].pb(x);
		}
	}
	rep(i, h) {
		int odl[n];
		rep(j, n) odl[j]=1000000007;
		queue<int>q;
		q.push(i);
		odl[i]=0;
		while(!q.empty()) {
			int p=q.front(); q.pop();
			for(auto j : V[p]) if(odl[j]>odl[p]+1) {
				odl[j]=odl[p]+1;
				q.push(j);
			}
		}
		rep(j, n) hops(i, j, odl[j]);
	}
}

Compilation message

encoder.cpp: In function 'void encode(int, int, int, std::vector<int>, std::vector<int>)':
encoder.cpp:38:34: error: 'p' was not declared in this scope
   38 |  rep(i, h) rep(j, 10) encode_bit(p[i]&(1<<j));
      |                                  ^