Submission #206367

# Submission time Handle Problem Language Result Execution time Memory
206367 2020-03-03T05:17:10 Z arnold518 City (JOI17_city) C++14
0 / 100
226 ms 22512 KB
#include "Encoder.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 25e4;

int N;
vector<int> adj[MAXN+10];
int L[MAXN+10], R[MAXN+10];

int cnt=1;
void dfs(int now, int bef)
{
	int l, r;
	L[now]=R[now]=cnt;
	if(now!=bef && adj[now].size()>1) cnt++;
	for(int nxt : adj[now])
	{
		if(nxt==bef) continue;
		dfs(nxt, now);
		R[now]=max(R[now], R[nxt]);
	}
	Code(now, (ll)L[now]*MAXN+R[now]);
}

void Encode(int _N, int A[], int B[])
{
	int i, j;
	N=_N;

	for(i=0; i<N-1; i++)
	{
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}

	dfs(0, 0);
}
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 25e4;

void InitDevice()
{

}

int Answer(ll S, ll T)
{
	int l1=S/MAXN, r1=S%MAXN;
	int l2=T/MAXN, r2=T%MAXN;

	if(l2<l1 && r1<=r2) return 0;
	if(l1<l2 && r2<=r1) return 1;
	return 2;
}

Compilation message

Encoder.cpp: In function 'void dfs(int, int)':
Encoder.cpp:18:6: warning: unused variable 'l' [-Wunused-variable]
  int l, r;
      ^
Encoder.cpp:18:9: warning: unused variable 'r' [-Wunused-variable]
  int l, r;
         ^
Encoder.cpp: In function 'void Encode(int, int*, int*)':
Encoder.cpp:32:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j;
         ^
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 12280 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 226 ms 22512 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -