Submission #426671

# Submission time Handle Problem Language Result Execution time Memory
426671 2021-06-14T08:54:19 Z 송준혁(#7530) City (JOI17_city) C++14
22 / 100
646 ms 43152 KB
#include "Encoder.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define MOD 1000000007
#define INF (1ll<<)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

static LL I[303030], num;
static vector<int> adj[303030], C;

static void f(int u, int p){
	I[u] = ++num;
	for (int v : adj[u]){
		if (v == p) continue;
		f(v, u);
	}
	int t=lb(C.begin(), C.end(), num-I[u])-C.begin();
	Code(u, I[u]*C.size()+t);
}

void Encode(int N, int A[], int B[]){
	int t=1;
	C.pb(0);
	while (t<250505){
		C.pb(t);
		t = max((int)(t*1), t+1);
	}
	for (int i=0; i<N-1; i++) adj[A[i]].pb(B[i]), adj[B[i]].pb(A[i]);
	f(0, -1);
}
#include "Device.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define MOD 1000000007
#define INF (1ll<<62)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

static vector<int> C;

void InitDevice(){
	int t=1;
	C.pb(0);
	while (t<250505){
		C.pb(t);
		t = max((int)(t*1), t+1);
	}
}

int Answer(long long S, long long T){
	int l1 = S/C.size(), r1 = l1 + C[S%C.size()];
	int l2 = T/C.size(), r2 = l2 + C[T%C.size()];
	if (l1 <= l2 && r2 <= r1) return 1;
	if (l2 <= l1 && r1 <= r2) return 0;
	return 2;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 10192 KB Output is correct
2 Correct 10 ms 10112 KB Output is correct
3 Correct 9 ms 10112 KB Output is correct
4 Correct 11 ms 10092 KB Output is correct
5 Correct 9 ms 10092 KB Output is correct
6 Correct 9 ms 10124 KB Output is correct
7 Correct 10 ms 10032 KB Output is correct
8 Correct 9 ms 10112 KB Output is correct
9 Correct 10 ms 10112 KB Output is correct
10 Correct 9 ms 10112 KB Output is correct
11 Correct 8 ms 10092 KB Output is correct
12 Correct 9 ms 10128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 238 ms 18348 KB Output is correct - L = 175353500
2 Correct 223 ms 18392 KB Output is correct - L = 175102995
3 Correct 202 ms 18528 KB Output is correct - L = 175353500
4 Correct 249 ms 18436 KB Output is correct - L = 175353500
5 Partially correct 622 ms 42376 KB Output is partially correct - L = 62626250000
6 Partially correct 577 ms 42348 KB Output is partially correct - L = 62626250000
7 Partially correct 646 ms 42348 KB Output is partially correct - L = 62626250000
8 Partially correct 624 ms 42080 KB Output is partially correct - L = 62626250000
9 Partially correct 531 ms 42908 KB Output is partially correct - L = 62626250000
10 Partially correct 459 ms 43092 KB Output is partially correct - L = 62626250000
11 Partially correct 483 ms 43152 KB Output is partially correct - L = 62626250000
12 Partially correct 493 ms 43076 KB Output is partially correct - L = 62626250000
13 Partially correct 552 ms 42796 KB Output is partially correct - L = 62626250000
14 Partially correct 609 ms 42844 KB Output is partially correct - L = 62626250000
15 Correct 201 ms 18404 KB Output is correct - L = 175353500
16 Correct 199 ms 18524 KB Output is correct - L = 175353500
17 Correct 199 ms 18408 KB Output is correct - L = 175353500
18 Partially correct 515 ms 42736 KB Output is partially correct - L = 62626250000
19 Partially correct 577 ms 42680 KB Output is partially correct - L = 62626250000
20 Partially correct 517 ms 42808 KB Output is partially correct - L = 62626250000
21 Partially correct 564 ms 42628 KB Output is partially correct - L = 62626250000
22 Partially correct 553 ms 42760 KB Output is partially correct - L = 62626250000
23 Partially correct 587 ms 42548 KB Output is partially correct - L = 62626250000
24 Partially correct 551 ms 42440 KB Output is partially correct - L = 62626250000
25 Partially correct 541 ms 42696 KB Output is partially correct - L = 62626250000
26 Partially correct 572 ms 42452 KB Output is partially correct - L = 62626250000
27 Partially correct 576 ms 42420 KB Output is partially correct - L = 62626250000