# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
427302 |
2021-06-14T14:07:16 Z |
oolimry |
City (JOI17_city) |
C++17 |
|
629 ms |
41832 KB |
#include "Encoder.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int) (x).size()
#define all(x) (x).begin(), (x).end()
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl;
#define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl;
#define tern(cond, a, b) (cond ? a : b)
typedef long long lint;
typedef pair<lint,lint> ii;
vector<int> adj[250005];
lint low[250005], high[250005];
lint cnt = 0;
void dfs(int u, int p){
high[u] = low[u] = cnt++;
for(int v : adj[u]){
if(v == p) continue;
dfs(v, u);
high[u] = high[v];
}
}
void Encode(int n, int A[], int B[]){
for(int i = 0;i < n-1;i++){
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
dfs(0, -1);
for(int i = 0; i < n; ++i){
Code(i, low[i]*250000LL+high[i]);
}
}
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int) (x).size()
#define all(x) (x).begin(), (x).end()
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl;
#define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl;
#define tern(cond, a, b) (cond ? a : b)
typedef long long lint;
typedef pair<lint,lint> ii;
void InitDevice(){
}
int Answer(long long S, long long T){
lint slow = S/250000;
lint shigh = S%250000;
lint tlow = T/250000;
lint thigh = T%250000;
if(slow <= tlow and thigh <= shigh) return 1;
else if(tlow <= slow and shigh <= thigh) return 0;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
6400 KB |
Output is correct |
2 |
Correct |
6 ms |
6388 KB |
Output is correct |
3 |
Correct |
6 ms |
6400 KB |
Output is correct |
4 |
Correct |
5 ms |
6460 KB |
Output is correct |
5 |
Correct |
5 ms |
6400 KB |
Output is correct |
6 |
Correct |
5 ms |
6396 KB |
Output is correct |
7 |
Correct |
6 ms |
6400 KB |
Output is correct |
8 |
Correct |
5 ms |
6404 KB |
Output is correct |
9 |
Correct |
5 ms |
6412 KB |
Output is correct |
10 |
Correct |
4 ms |
6376 KB |
Output is correct |
11 |
Correct |
6 ms |
6400 KB |
Output is correct |
12 |
Correct |
6 ms |
6412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
201 ms |
14896 KB |
Output is correct - L = 174750699 |
2 |
Correct |
229 ms |
15056 KB |
Output is correct - L = 174500698 |
3 |
Correct |
212 ms |
15004 KB |
Output is correct - L = 174750699 |
4 |
Correct |
196 ms |
15080 KB |
Output is correct - L = 174750699 |
5 |
Partially correct |
483 ms |
40944 KB |
Output is partially correct - L = 62499999999 |
6 |
Partially correct |
531 ms |
40964 KB |
Output is partially correct - L = 62499999999 |
7 |
Partially correct |
571 ms |
40996 KB |
Output is partially correct - L = 62499999999 |
8 |
Partially correct |
629 ms |
40712 KB |
Output is partially correct - L = 62499999999 |
9 |
Partially correct |
438 ms |
41592 KB |
Output is partially correct - L = 62499999999 |
10 |
Partially correct |
464 ms |
41596 KB |
Output is partially correct - L = 62499999999 |
11 |
Partially correct |
528 ms |
41832 KB |
Output is partially correct - L = 62499999999 |
12 |
Partially correct |
421 ms |
41700 KB |
Output is partially correct - L = 62499999999 |
13 |
Partially correct |
483 ms |
41548 KB |
Output is partially correct - L = 62499999999 |
14 |
Partially correct |
507 ms |
41108 KB |
Output is partially correct - L = 62499999999 |
15 |
Correct |
205 ms |
15016 KB |
Output is correct - L = 174750699 |
16 |
Correct |
203 ms |
15120 KB |
Output is correct - L = 174750699 |
17 |
Correct |
197 ms |
15004 KB |
Output is correct - L = 174750699 |
18 |
Partially correct |
471 ms |
41276 KB |
Output is partially correct - L = 62499999999 |
19 |
Partially correct |
491 ms |
41188 KB |
Output is partially correct - L = 62499999999 |
20 |
Partially correct |
532 ms |
41260 KB |
Output is partially correct - L = 62499999999 |
21 |
Partially correct |
501 ms |
41248 KB |
Output is partially correct - L = 62499999999 |
22 |
Partially correct |
526 ms |
41160 KB |
Output is partially correct - L = 62499999999 |
23 |
Partially correct |
464 ms |
41144 KB |
Output is partially correct - L = 62499999999 |
24 |
Partially correct |
526 ms |
41152 KB |
Output is partially correct - L = 62499999999 |
25 |
Partially correct |
549 ms |
41024 KB |
Output is partially correct - L = 62499999999 |
26 |
Partially correct |
512 ms |
41060 KB |
Output is partially correct - L = 62499999999 |
27 |
Partially correct |
523 ms |
40964 KB |
Output is partially correct - L = 62499999999 |