#include "Encoder.h"
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = 3e5+10;
int tin[maxn], tout[maxn], timer;
vector<int> g[maxn];
void dfs(int u, int ant) {
tin[u] = ++timer;
for(auto v : g[u]) if(v != ant) {
dfs(v,u);
}
tout[u] = timer;
}
int mxv = (1<<18);
void Encode(int32_t N, int32_t A[], int32_t B[]) {
for(int i = 0; i < N-1; i++) {
g[A[i]].pb(B[i]);
g[B[i]].pb(A[i]);
}
dfs(0,0);
for(int i = 0; i < N; i++) {
// cout << i << " " << 1000000*tin[i]+tout[i] << endl;
Code(i,mxv*tin[i]+tout[i]);
}
}
// int32_t main() {
// ios::sync_with_stdio(false); cin.tie(0);
// freopen("in.in", "r", stdin);
// // freopen("out.out", "w", stdout);
// int32_t n; cin >> n;
// int32_t a[n-1],b[n-1];
// for(int i = 0; i < n-1; i++) {
// cin >> a[i] >> b[i];
// }
// Encode(n,a,b);
// }
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = -1;
void InitDevice() {}
int mxv = (1<<18);
int32_t Answer(int S, int T) {
int in1 = S/(mxv);
int out1 = S-in1*mxv;
int in2 = T/(mxv);
int out2 = T-in2*mxv;
if(in1 <= in2 && out1 >= out2) {
return 1;
}
else if(in2 <= in1 && out2 >= out1) {
return 0;
}
else {
return 2;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7716 KB |
Output is correct |
2 |
Correct |
4 ms |
7716 KB |
Output is correct |
3 |
Correct |
4 ms |
7708 KB |
Output is correct |
4 |
Correct |
4 ms |
7716 KB |
Output is correct |
5 |
Correct |
4 ms |
7708 KB |
Output is correct |
6 |
Correct |
4 ms |
7708 KB |
Output is correct |
7 |
Correct |
4 ms |
7708 KB |
Output is correct |
8 |
Correct |
4 ms |
7716 KB |
Output is correct |
9 |
Correct |
4 ms |
7712 KB |
Output is correct |
10 |
Correct |
3 ms |
7716 KB |
Output is correct |
11 |
Correct |
4 ms |
7708 KB |
Output is correct |
12 |
Correct |
3 ms |
7720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
153 ms |
16288 KB |
Output is correct - L = 183501500 |
2 |
Correct |
177 ms |
16152 KB |
Output is correct - L = 183239355 |
3 |
Correct |
174 ms |
16324 KB |
Output is correct - L = 183501500 |
4 |
Correct |
156 ms |
16240 KB |
Output is correct - L = 183501500 |
5 |
Partially correct |
379 ms |
43476 KB |
Output is partially correct - L = 65536250000 |
6 |
Partially correct |
391 ms |
43540 KB |
Output is partially correct - L = 65536250000 |
7 |
Partially correct |
377 ms |
43636 KB |
Output is partially correct - L = 65536250000 |
8 |
Partially correct |
385 ms |
45032 KB |
Output is partially correct - L = 65536250000 |
9 |
Partially correct |
324 ms |
43772 KB |
Output is partially correct - L = 65536250000 |
10 |
Partially correct |
308 ms |
43920 KB |
Output is partially correct - L = 65536250000 |
11 |
Partially correct |
309 ms |
43900 KB |
Output is partially correct - L = 65536250000 |
12 |
Partially correct |
314 ms |
43864 KB |
Output is partially correct - L = 65536250000 |
13 |
Partially correct |
343 ms |
43704 KB |
Output is partially correct - L = 65536250000 |
14 |
Partially correct |
371 ms |
43924 KB |
Output is partially correct - L = 65536250000 |
15 |
Correct |
156 ms |
16232 KB |
Output is correct - L = 183501500 |
16 |
Correct |
151 ms |
16240 KB |
Output is correct - L = 183501500 |
17 |
Correct |
158 ms |
16236 KB |
Output is correct - L = 183501500 |
18 |
Partially correct |
337 ms |
43032 KB |
Output is partially correct - L = 65536250000 |
19 |
Partially correct |
355 ms |
42888 KB |
Output is partially correct - L = 65536250000 |
20 |
Partially correct |
354 ms |
43048 KB |
Output is partially correct - L = 65536250000 |
21 |
Partially correct |
354 ms |
43564 KB |
Output is partially correct - L = 65536250000 |
22 |
Partially correct |
379 ms |
43072 KB |
Output is partially correct - L = 65536250000 |
23 |
Partially correct |
362 ms |
42708 KB |
Output is partially correct - L = 65536250000 |
24 |
Partially correct |
369 ms |
42572 KB |
Output is partially correct - L = 65536250000 |
25 |
Partially correct |
372 ms |
42500 KB |
Output is partially correct - L = 65536250000 |
26 |
Partially correct |
388 ms |
42420 KB |
Output is partially correct - L = 65536250000 |
27 |
Partially correct |
388 ms |
42564 KB |
Output is partially correct - L = 65536250000 |