# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
60991 |
2018-07-25T05:23:15 Z |
윤교준(#1762) |
City (JOI17_city) |
C++11 |
|
3000 ms |
55352 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];
}
for(int k = 1;; k <<= 1) if(C[i] <= k) {
C[i] = k;
break;
}
c = O[i] + C[i] - 1;
}
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 <<= 10;
for(int k = 0; k < 32; k++)
if(C[i] == (1<<k))
key |= k;
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>>10), sc = S&((1<<10)-1);
int ti = (T>>10), tc = T&((1<<10)-1);
sc = 1<<sc; tc = 1<<tc;
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 |
12288 KB |
Output is correct |
2 |
Correct |
8 ms |
12544 KB |
Output is correct |
3 |
Correct |
9 ms |
12288 KB |
Output is correct |
4 |
Correct |
9 ms |
12288 KB |
Output is correct |
5 |
Correct |
9 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 |
9 ms |
12544 KB |
Output is correct |
11 |
Correct |
8 ms |
12544 KB |
Output is correct |
12 |
Correct |
8 ms |
12288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
167 ms |
19608 KB |
Output is correct - L = 9442304 |
2 |
Correct |
165 ms |
19440 KB |
Output is correct - L = 67158016 |
3 |
Correct |
169 ms |
19608 KB |
Output is correct - L = 7168000 |
4 |
Correct |
168 ms |
19384 KB |
Output is correct - L = 39154688 |
5 |
Partially correct |
480 ms |
55296 KB |
Output is partially correct - L = 89949488128 |
6 |
Partially correct |
474 ms |
55192 KB |
Output is partially correct - L = 104163587072 |
7 |
Partially correct |
461 ms |
55352 KB |
Output is partially correct - L = 77461553152 |
8 |
Execution timed out |
3056 ms |
19824 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |