Submission #1115130

#TimeUsernameProblemLanguageResultExecution timeMemory
1115130thelegendary08Flights (JOI22_flights)C++17
Compilation error
0 ms0 KiB
#include "Ali.h"
#include<bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i<n; i++)
#define pb push_back
#define vi vector<int>
#define FOR(i, k, n) for(int i = k; i< n; i++)
using namespace std;
namespace {

int n2;
vector<vi>adj2;
vi par2;
void dfs2(int x, int from){
	for(auto u : adj2[x]){
		if(u != from){
			par2[u] = x;
			dfs2(u,x);
		}
	}
}
}

}

void Init(int N, std::vector<int> U, std::vector<int> V) {
  n2 = N;
	f0r(i,N){
		SetID(i,i);
	}
	adj2.resize(N);
	par2.resize(N);
	f0r(i,N-1){
		adj2[U[i]].pb(V[i]);
		adj2[V[i]].pb(U[i]);
	}
	dfs2(0,-1);
	par2[0] = -1;
	//vout(par2);
}

std::string SendA(std::string S) {
	
	string s;
	FOR(i, 1, n2){
		int cur = par2[i];
		f0r(j, 14){
			if((1 << j) & cur){
				s += '1';
			}
			else s += '0';
		}
	}
	return s;
	//return "";
}

#include "Benjamin.h"
#include<bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i<n; i++)
#define pb push_back
#define vi vector<int>
#define FOR(i, k, n) for(int i = k; i< n; i++)
using namespace std;
namespace {

int n;
int ex,ey;
vi par;
vi dist;
vector<vi>adj;
void dfs(int x, int from){
	for(auto u : adj[x]){
		if(u != from){
			dist[u] = dist[x] + 1;
			dfs(u,x);
		}
	}
}
}

std::string SendB(int N, int X, int Y) {
	
	n = N;
	ex = X;
	ey = Y;
  	string s;
  	f0r(i, 20)s += '0';
  	return s;
  	
  	//return "";
}

int Answer(std::string T) {
	
	par.resize(n);
	dist.resize(n);
	adj.resize(n);
	f0r(i,n)dist[i] = 1e9;
	//cout<<T.size()<<'\n';
	//cout<<T<<'\n';
	for(int i = 0; i<T.size(); i+=14){
		//cout<<T.substr(i, 14)<<'\n';
		int cur = 0;
		FOR(j, i, i+14){
			cur += (T[j] - '0') * (1<<(j-i));
		}
		par[i/14+1] = cur;
		adj[i/14+1].pb(cur);
		adj[cur].pb(i/14+1);
		//cout<<i/14+1<<' '<<cur<<'\n';
	}
	//cout<<ex<<' '<<ey<<'\n';
	
	
	par[0] = -1;
	dist[ex] = 0;
	dfs(ex,-1);
	return dist[ey];
	
	return 0;
}

Compilation message (stderr)

Ali.cpp:23:1: error: expected declaration before '}' token
   23 | }
      | ^
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~

Benjamin.cpp: In function 'int Answer(std::string)':
Benjamin.cpp:45:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |  for(int i = 0; i<T.size(); i+=14){
      |                 ~^~~~~~~~~