답안 #206368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206368 2020-03-03T05:20:22 Z arnold518 City (JOI17_city) C++14
22 / 100
604 ms 59912 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=0;
void dfs(int now, int bef)
{
	int l, r;
	L[now]=R[now]=cnt;
	//if(now!=bef && adj[now].size()>1) cnt++;
	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:33:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j;
         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 12272 KB Output is correct
2 Correct 13 ms 12272 KB Output is correct
3 Correct 12 ms 12528 KB Output is correct
4 Correct 13 ms 12528 KB Output is correct
5 Correct 13 ms 12528 KB Output is correct
6 Correct 13 ms 12528 KB Output is correct
7 Correct 13 ms 12528 KB Output is correct
8 Correct 13 ms 12272 KB Output is correct
9 Correct 12 ms 12528 KB Output is correct
10 Correct 13 ms 12528 KB Output is correct
11 Correct 15 ms 12528 KB Output is correct
12 Correct 13 ms 12528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 225 ms 19696 KB Output is correct - L = 174750699
2 Correct 229 ms 22512 KB Output is correct - L = 174500698
3 Correct 225 ms 22512 KB Output is correct - L = 174750699
4 Correct 227 ms 22512 KB Output is correct - L = 174750699
5 Partially correct 565 ms 58352 KB Output is partially correct - L = 62499999999
6 Partially correct 557 ms 58640 KB Output is partially correct - L = 62499999999
7 Partially correct 570 ms 58608 KB Output is partially correct - L = 62499999999
8 Partially correct 568 ms 58608 KB Output is partially correct - L = 62499999999
9 Partially correct 498 ms 59856 KB Output is partially correct - L = 62499999999
10 Partially correct 479 ms 59864 KB Output is partially correct - L = 62499999999
11 Partially correct 481 ms 59856 KB Output is partially correct - L = 62499999999
12 Partially correct 472 ms 59912 KB Output is partially correct - L = 62499999999
13 Partially correct 522 ms 59104 KB Output is partially correct - L = 62499999999
14 Partially correct 543 ms 58856 KB Output is partially correct - L = 62499999999
15 Correct 225 ms 22512 KB Output is correct - L = 174750699
16 Correct 220 ms 22504 KB Output is correct - L = 174750699
17 Correct 233 ms 22512 KB Output is correct - L = 174750699
18 Partially correct 542 ms 58840 KB Output is partially correct - L = 62499999999
19 Partially correct 531 ms 58848 KB Output is partially correct - L = 62499999999
20 Partially correct 532 ms 58848 KB Output is partially correct - L = 62499999999
21 Partially correct 546 ms 59104 KB Output is partially correct - L = 62499999999
22 Partially correct 559 ms 58848 KB Output is partially correct - L = 62499999999
23 Partially correct 532 ms 58592 KB Output is partially correct - L = 62499999999
24 Partially correct 548 ms 58608 KB Output is partially correct - L = 62499999999
25 Partially correct 555 ms 58608 KB Output is partially correct - L = 62499999999
26 Partially correct 583 ms 58608 KB Output is partially correct - L = 62499999999
27 Partially correct 604 ms 58352 KB Output is partially correct - L = 62499999999