Submission #60977

# Submission time Handle Problem Language Result Execution time Memory
60977 2018-07-25T04:56:25 Z 윤교준(#1762) City (JOI17_city) C++11
22 / 100
499 ms 56768 KB
#include "Encoder.h"
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define revv(V) reverse(allv(V))
#define sz(V) ((int)(V).size())
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
static void fg(vector<int> G[], int a, int b) { G[a].eb(b); G[b].eb(a); }

static const int MAXN = 250005;

static vector<int> G[MAXN];

static int O[MAXN], C[MAXN];
static int A[MAXN], B[MAXN];

static int N;

static void dfs(int i, int &c) {
	c++; O[i] = c; C[i] = 1;
	for(int v : G[i]) if(!O[v]) {
		dfs(v, c);
		C[i] += C[v];
	}
}

void Encode(int N, int A[], int B[]) {
	::N = N;
	for(int i = 0; i < N-1; i++) {
		::A[i] = A[i];
		::B[i] = B[i];
		fg(G, A[i], B[i]);
	}

	{ int t = 0; dfs(0, t); }

	for(int i = 0; i < N; i++) {
		ll key = O[i]-1;
		key <<= 18;
		key |= C[i];

		Code(i, key);
	}
}
#include "Device.h"
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define revv(V) reverse(allv(V))
#define sz(V) ((int)(V).size())
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

void InitDevice() {
}

int Answer(long long S, long long T) {
	int si = (S>>18), sc = S&((1<<18)-1);
	int ti = (T>>18), tc = T&((1<<18)-1);

	if(ti < si && si < ti+tc) return 0;
	if(si < ti && ti < si+sc) return 1;
	return 2;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 12536 KB Output is correct
2 Correct 9 ms 12504 KB Output is correct
3 Correct 9 ms 12288 KB Output is correct
4 Correct 8 ms 12544 KB Output is correct
5 Correct 8 ms 12288 KB Output is correct
6 Correct 9 ms 12544 KB Output is correct
7 Correct 8 ms 12288 KB Output is correct
8 Correct 8 ms 12544 KB Output is correct
9 Correct 8 ms 12488 KB Output is correct
10 Correct 8 ms 12288 KB Output is correct
11 Correct 8 ms 12288 KB Output is correct
12 Correct 9 ms 12288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 166 ms 19504 KB Output is correct - L = 183238657
2 Correct 164 ms 19528 KB Output is correct - L = 182976513
3 Correct 162 ms 19440 KB Output is correct - L = 183238657
4 Correct 167 ms 19440 KB Output is correct - L = 183238657
5 Partially correct 482 ms 55536 KB Output is partially correct - L = 65535737857
6 Partially correct 473 ms 55328 KB Output is partially correct - L = 65535737857
7 Partially correct 457 ms 55224 KB Output is partially correct - L = 65535737857
8 Partially correct 499 ms 54712 KB Output is partially correct - L = 65535737857
9 Partially correct 398 ms 56472 KB Output is partially correct - L = 65535737857
10 Partially correct 402 ms 56768 KB Output is partially correct - L = 65535737857
11 Partially correct 378 ms 56528 KB Output is partially correct - L = 65535737857
12 Partially correct 390 ms 56536 KB Output is partially correct - L = 65535737857
13 Partially correct 436 ms 55976 KB Output is partially correct - L = 65535737857
14 Partially correct 468 ms 55472 KB Output is partially correct - L = 65535737857
15 Correct 164 ms 19560 KB Output is correct - L = 183238657
16 Correct 167 ms 19520 KB Output is correct - L = 183238657
17 Correct 164 ms 19496 KB Output is correct - L = 183238657
18 Partially correct 450 ms 55640 KB Output is partially correct - L = 65535737857
19 Partially correct 449 ms 55656 KB Output is partially correct - L = 65535737857
20 Partially correct 454 ms 55720 KB Output is partially correct - L = 65535737857
21 Partially correct 426 ms 55520 KB Output is partially correct - L = 65535737857
22 Partially correct 471 ms 55584 KB Output is partially correct - L = 65535737857
23 Partially correct 452 ms 55464 KB Output is partially correct - L = 65535737857
24 Partially correct 460 ms 55304 KB Output is partially correct - L = 65535737857
25 Partially correct 472 ms 55376 KB Output is partially correct - L = 65535737857
26 Partially correct 491 ms 55400 KB Output is partially correct - L = 65535737857
27 Partially correct 457 ms 55024 KB Output is partially correct - L = 65535737857