#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define setbits(x) __builtin_popcountll(x)
#define ff first
#define ss second
#define conts continue
#define ceil2(x,y) ((x+y-1)/(y))
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rev(i,s,e) for(int i = s; i >= e; --i)
#define trav(i,a) for(auto &i : a)
template<typename T>
void amin(T &a, T b) {
a = min(a,b);
}
template<typename T>
void amax(T &a, T b) {
a = max(a,b);
}
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
/*
*/
const int MOD = 1e9 + 7;
const int N = 3e5 + 5;
const int inf1 = int(1e9) + 5;
const ll inf2 = ll(1e18) + 5;
#include "Encoder.h"
vector<ll> adj[N];
vector<ll> tin(N), tout(N);
ll timer = 0;
void dfs1(ll u, ll p){
tin[u] = timer++;
trav(v,adj[u]){
if(v == p) conts;
dfs1(v,u);
}
tout[u] = timer-1;
}
void Encode(int n, int A[], int B[])
{
// for (int i = 0; i < N; ++i) {
// Code(i, 0LL);
// }
rep(i,n-1){
ll u = A[i], v = B[i];
adj[u].pb(v), adj[v].pb(u);
}
dfs1(0,-1);
ll mul = 250000;
rep(i,n){
ll val = tin[i]*mul+tout[i];
Code(i,val);
}
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define setbits(x) __builtin_popcountll(x)
#define ff first
#define ss second
#define conts continue
#define ceil2(x,y) ((x+y-1)/(y))
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rev(i,s,e) for(int i = s; i >= e; --i)
#define trav(i,a) for(auto &i : a)
template<typename T>
void amin(T &a, T b) {
a = min(a,b);
}
template<typename T>
void amax(T &a, T b) {
a = max(a,b);
}
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
/*
*/
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
const int inf1 = int(1e9) + 5;
const ll inf2 = ll(1e18) + 5;
#include "Device.h"
void InitDevice()
{
}
int Answer(long long S, long long T)
{
ll mul = 250000;
ll tin1 = S/mul, tout1 = S%mul;
ll tin2 = T/mul, tout2 = T%mul;
if(tin2 <= tin1 and tout2 >= tout1){
return 0;
}
if(tin1 <= tin2 and tout1 >= tout2){
return 1;
}
return 2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
12608 KB |
Output is correct |
2 |
Correct |
6 ms |
12604 KB |
Output is correct |
3 |
Correct |
7 ms |
12612 KB |
Output is correct |
4 |
Correct |
8 ms |
12608 KB |
Output is correct |
5 |
Correct |
6 ms |
12612 KB |
Output is correct |
6 |
Correct |
7 ms |
12596 KB |
Output is correct |
7 |
Correct |
7 ms |
12604 KB |
Output is correct |
8 |
Correct |
8 ms |
12604 KB |
Output is correct |
9 |
Correct |
7 ms |
12612 KB |
Output is correct |
10 |
Correct |
7 ms |
12600 KB |
Output is correct |
11 |
Correct |
7 ms |
12612 KB |
Output is correct |
12 |
Correct |
7 ms |
12712 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
129 ms |
21148 KB |
Output is correct - L = 174750699 |
2 |
Correct |
135 ms |
21004 KB |
Output is correct - L = 174500698 |
3 |
Correct |
133 ms |
21072 KB |
Output is correct - L = 174750699 |
4 |
Correct |
128 ms |
21152 KB |
Output is correct - L = 174750699 |
5 |
Partially correct |
321 ms |
44436 KB |
Output is partially correct - L = 62499999999 |
6 |
Partially correct |
290 ms |
57824 KB |
Output is partially correct - L = 62499999999 |
7 |
Partially correct |
290 ms |
57820 KB |
Output is partially correct - L = 62499999999 |
8 |
Partially correct |
323 ms |
59388 KB |
Output is partially correct - L = 62499999999 |
9 |
Partially correct |
278 ms |
58292 KB |
Output is partially correct - L = 62499999999 |
10 |
Partially correct |
280 ms |
58332 KB |
Output is partially correct - L = 62499999999 |
11 |
Partially correct |
257 ms |
58388 KB |
Output is partially correct - L = 62499999999 |
12 |
Partially correct |
267 ms |
58308 KB |
Output is partially correct - L = 62499999999 |
13 |
Partially correct |
287 ms |
58180 KB |
Output is partially correct - L = 62499999999 |
14 |
Partially correct |
298 ms |
57800 KB |
Output is partially correct - L = 62499999999 |
15 |
Correct |
131 ms |
27948 KB |
Output is correct - L = 174750699 |
16 |
Correct |
130 ms |
27744 KB |
Output is correct - L = 174750699 |
17 |
Correct |
133 ms |
27988 KB |
Output is correct - L = 174750699 |
18 |
Partially correct |
315 ms |
57420 KB |
Output is partially correct - L = 62499999999 |
19 |
Partially correct |
312 ms |
57132 KB |
Output is partially correct - L = 62499999999 |
20 |
Partially correct |
287 ms |
57120 KB |
Output is partially correct - L = 62499999999 |
21 |
Partially correct |
293 ms |
57928 KB |
Output is partially correct - L = 62499999999 |
22 |
Partially correct |
280 ms |
57048 KB |
Output is partially correct - L = 62499999999 |
23 |
Partially correct |
290 ms |
57132 KB |
Output is partially correct - L = 62499999999 |
24 |
Partially correct |
299 ms |
57092 KB |
Output is partially correct - L = 62499999999 |
25 |
Partially correct |
307 ms |
56756 KB |
Output is partially correct - L = 62499999999 |
26 |
Partially correct |
322 ms |
56796 KB |
Output is partially correct - L = 62499999999 |
27 |
Partially correct |
303 ms |
57004 KB |
Output is partially correct - L = 62499999999 |