Submission #1080409

#TimeUsernameProblemLanguageResultExecution timeMemory
1080409thelegendary08City (JOI17_city)C++14
Compilation error
0 ms0 KiB
#include "Encoder.h"
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define vi vector<ll>
#define vvi vector<vector<int>>
#define vll vector<long long int>
#define vvll vector<vector<long long int>>
#define pii pair<int, int>
#define vpii vector<pair<int, int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define mii map<int,int>
#define mll map<long long int, long long int>
#define mivi map<int,vector<int>>
#define f0r(i,n) for(int i=0;i<n;i++)
#define FOR(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int mxn = 250005;

vi order;
vi adj[mxn];
vb vis(mxn, 0);
vi sz(mxn, 0);
vi code(mxn, 0);
void dfs(int x){
	if(vis[x])return;
	int cur = 1;
	vis[x] = 1;
	order.pb(x);
	for(auto u : adj[x]){
		dfs(u);
	}
}
int getsz(int x, int from){
	int cur = 1;
	for(auto u : adj[x]){
		if(u != from){
			cur += getsz(u, x);
		}
	}
	sz[x] = cur;
	return cur;
}
void Encode(int n, int a[], int b[])
{
	f0r(i, n-1){
		adj[a[i]].pb(b[i]);
		adj[b[i]].pb(a[i]);
	}
	dfs(0);
	f0r(i, n){
		code[order[i]] = i;
	}
	getsz(0, -1);
	
	for (int i = 0; i < n; ++i) {
		int c = (1ll<<18) * sz[i] + code[i];
		
		Code(i, c);
		//cout<<i<<' '<<sz[i]<<' '<<code[i]<<'\n';
	}
}
#include "Device.h"

void InitDevice()
{
}

int Answer(long long S, long long T)
{
	//cout<<S<<' '<<T<<'\n';
	ll szs = S / 262144;
	ll szt = T / 262144;
	ll cs = S % 262144;
	ll ct = T % 262144;
	//cout<<cs<<' '<<ct<<' '<<szs<<' '<<szt<<'\n';
	if(cs + szs > ct && ct > cs)return 1;
	if(ct + szt > cs && cs > ct)return 0;
	return 2;
}

Compilation message (stderr)

Encoder.cpp: In function 'void dfs(int)':
Encoder.cpp:29:6: warning: unused variable 'cur' [-Wunused-variable]
   29 |  int cur = 1;
      |      ^~~

Device.cpp: In function 'int Answer(long long int, long long int)':
Device.cpp:10:2: error: 'll' was not declared in this scope
   10 |  ll szs = S / 262144;
      |  ^~
Device.cpp:11:4: error: expected ';' before 'szt'
   11 |  ll szt = T / 262144;
      |    ^~~~
      |    ;
Device.cpp:12:4: error: expected ';' before 'cs'
   12 |  ll cs = S % 262144;
      |    ^~~
      |    ;
Device.cpp:13:4: error: expected ';' before 'ct'
   13 |  ll ct = T % 262144;
      |    ^~~
      |    ;
Device.cpp:15:5: error: 'cs' was not declared in this scope
   15 |  if(cs + szs > ct && ct > cs)return 1;
      |     ^~
Device.cpp:15:10: error: 'szs' was not declared in this scope
   15 |  if(cs + szs > ct && ct > cs)return 1;
      |          ^~~
Device.cpp:15:16: error: 'ct' was not declared in this scope
   15 |  if(cs + szs > ct && ct > cs)return 1;
      |                ^~
Device.cpp:16:5: error: 'ct' was not declared in this scope
   16 |  if(ct + szt > cs && cs > ct)return 0;
      |     ^~
Device.cpp:16:10: error: 'szt' was not declared in this scope
   16 |  if(ct + szt > cs && cs > ct)return 0;
      |          ^~~
Device.cpp:16:16: error: 'cs' was not declared in this scope
   16 |  if(ct + szt > cs && cs > ct)return 0;
      |                ^~