# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
102229 |
2019-03-23T17:32:43 Z |
Benq |
City (JOI17_city) |
C++14 |
|
533 ms |
53416 KB |
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize
const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;
const ld PI = 4*atan((ld)1);
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
template<class A, class B> A operator+=(A& l, const B& r) { return l = l+r; }
template<class A, class B> A operator-=(A& l, const B& r) { return l = l-r; }
template<class A, class B> A operator*=(A& l, const B& r) { return l = l*r; }
template<class A, class B> A operator/=(A& l, const B& r) { return l = l/r; }
#include "Encoder.h"
vi adj[1<<18];
int dfs(int x, int y, int st) {
int ST = st+1;
trav(i,adj[x]) if (i != y) ST = dfs(i,x,ST);
Code(x,((ll)st<<18)+(ST-st));
return ST;
}
void Encode(int N, int A[], int B[]) {
F0R(i,N-1) adj[A[i]].pb(B[i]), adj[B[i]].pb(A[i]);
dfs(0,-1,0);
}
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize
const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;
const ld PI = 4*atan((ld)1);
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
template<class A, class B> A operator+=(A& l, const B& r) { return l = l+r; }
template<class A, class B> A operator-=(A& l, const B& r) { return l = l-r; }
template<class A, class B> A operator*=(A& l, const B& r) { return l = l*r; }
template<class A, class B> A operator/=(A& l, const B& r) { return l = l/r; }
#include "Device.h"
void InitDevice() {
}
pi decode(ll x) {
pi a = {x>>18,x%(1<<18)};
a.s += a.f;
return a;
}
bool contain(pi a, pi b) {
return a.f <= b.f && b.s <= a.s;
}
int Answer(long long S, long long T) {
pi X = decode(S), Y = decode(T);
if (contain(X,Y)) return 1;
if (contain(Y,X)) return 0;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
13056 KB |
Output is correct |
2 |
Correct |
9 ms |
13056 KB |
Output is correct |
3 |
Correct |
9 ms |
13056 KB |
Output is correct |
4 |
Correct |
9 ms |
13056 KB |
Output is correct |
5 |
Correct |
9 ms |
13056 KB |
Output is correct |
6 |
Correct |
9 ms |
13056 KB |
Output is correct |
7 |
Correct |
8 ms |
13056 KB |
Output is correct |
8 |
Correct |
9 ms |
13056 KB |
Output is correct |
9 |
Correct |
8 ms |
13056 KB |
Output is correct |
10 |
Correct |
8 ms |
13056 KB |
Output is correct |
11 |
Correct |
9 ms |
13056 KB |
Output is correct |
12 |
Correct |
9 ms |
13056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
169 ms |
19952 KB |
Output is correct - L = 183238657 |
2 |
Correct |
169 ms |
19952 KB |
Output is correct - L = 182976513 |
3 |
Correct |
173 ms |
20032 KB |
Output is correct - L = 183238657 |
4 |
Correct |
170 ms |
19968 KB |
Output is correct - L = 183238657 |
5 |
Partially correct |
507 ms |
51776 KB |
Output is partially correct - L = 65535737857 |
6 |
Partially correct |
481 ms |
51952 KB |
Output is partially correct - L = 65535737857 |
7 |
Partially correct |
495 ms |
51920 KB |
Output is partially correct - L = 65535737857 |
8 |
Partially correct |
478 ms |
51552 KB |
Output is partially correct - L = 65535737857 |
9 |
Partially correct |
413 ms |
53240 KB |
Output is partially correct - L = 65535737857 |
10 |
Partially correct |
393 ms |
53416 KB |
Output is partially correct - L = 65535737857 |
11 |
Partially correct |
389 ms |
53200 KB |
Output is partially correct - L = 65535737857 |
12 |
Partially correct |
424 ms |
53352 KB |
Output is partially correct - L = 65535737857 |
13 |
Partially correct |
454 ms |
52704 KB |
Output is partially correct - L = 65535737857 |
14 |
Partially correct |
456 ms |
52456 KB |
Output is partially correct - L = 65535737857 |
15 |
Correct |
176 ms |
19992 KB |
Output is correct - L = 183238657 |
16 |
Correct |
173 ms |
19896 KB |
Output is correct - L = 183238657 |
17 |
Correct |
175 ms |
20032 KB |
Output is correct - L = 183238657 |
18 |
Partially correct |
432 ms |
52280 KB |
Output is partially correct - L = 65535737857 |
19 |
Partially correct |
434 ms |
52376 KB |
Output is partially correct - L = 65535737857 |
20 |
Partially correct |
464 ms |
52456 KB |
Output is partially correct - L = 65535737857 |
21 |
Partially correct |
446 ms |
52328 KB |
Output is partially correct - L = 65535737857 |
22 |
Partially correct |
474 ms |
52168 KB |
Output is partially correct - L = 65535737857 |
23 |
Partially correct |
477 ms |
52280 KB |
Output is partially correct - L = 65535737857 |
24 |
Partially correct |
468 ms |
52152 KB |
Output is partially correct - L = 65535737857 |
25 |
Partially correct |
475 ms |
52136 KB |
Output is partially correct - L = 65535737857 |
26 |
Partially correct |
533 ms |
52080 KB |
Output is partially correct - L = 65535737857 |
27 |
Partially correct |
524 ms |
51856 KB |
Output is partially correct - L = 65535737857 |