# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
934032 |
2024-02-26T17:26:36 Z |
Saul0906 |
City (JOI17_city) |
C++14 |
|
332 ms |
57408 KB |
#include <bits/stdc++.h>
#include "Encoder.h"
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
#define ll long long
#define pb push_back
using namespace std;
const int lim=3e5+5;
ll tim=0, tin[lim], tout[lim];
vector<int> ady[lim];
void dfs(int u, int p){
tin[u]=tim;
repa(v,ady[u]){
if(v!=p) dfs(v,u);
}
tout[u]=tim++;
}
void Encode(int N, int *A, int *B){
rep(i,0,N-1){
ady[A[i]].pb(B[i]);
ady[B[i]].pb(A[i]);
}
dfs(0,-1);
rep(i,0,N){
ll x=tout[i]-tin[i];
x<<=18;
x+=tin[i];
//cout<<i<<" "<<x<<" "<<tin[i]<<" "<<tout[i]<<endl;
Code(i,x);
}
}
#include <bits/stdc++.h>
#include "Device.h"
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
#define ll long long
using namespace std;
void InitDevice(){
return;
}
const ll md=1<<18;
int Answer(ll S, ll T){
ll a, b, c, d;
a=(S%md);
S>>=18;
b=(S%md);
c=(T%md);
T>>=18;
d=(T%md);
b+=a;
d+=c;
if(a<=c && d<=b) return 1;
if(c<=a && b<=d) return 0;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
17424 KB |
Output is correct |
2 |
Correct |
3 ms |
17428 KB |
Output is correct |
3 |
Correct |
5 ms |
17436 KB |
Output is correct |
4 |
Correct |
3 ms |
17436 KB |
Output is correct |
5 |
Correct |
3 ms |
17440 KB |
Output is correct |
6 |
Correct |
3 ms |
17428 KB |
Output is correct |
7 |
Correct |
4 ms |
17440 KB |
Output is correct |
8 |
Correct |
4 ms |
17440 KB |
Output is correct |
9 |
Correct |
4 ms |
17428 KB |
Output is correct |
10 |
Correct |
3 ms |
17424 KB |
Output is correct |
11 |
Correct |
3 ms |
17456 KB |
Output is correct |
12 |
Correct |
4 ms |
17428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
127 ms |
29004 KB |
Output is correct - L = 183238656 |
2 |
Correct |
128 ms |
31128 KB |
Output is correct - L = 182976512 |
3 |
Correct |
127 ms |
31160 KB |
Output is correct - L = 183238656 |
4 |
Correct |
127 ms |
31148 KB |
Output is correct - L = 183238656 |
5 |
Partially correct |
270 ms |
54220 KB |
Output is partially correct - L = 65535737856 |
6 |
Partially correct |
254 ms |
56448 KB |
Output is partially correct - L = 65535737856 |
7 |
Partially correct |
271 ms |
56660 KB |
Output is partially correct - L = 65535737856 |
8 |
Partially correct |
291 ms |
56252 KB |
Output is partially correct - L = 65535737856 |
9 |
Partially correct |
250 ms |
57216 KB |
Output is partially correct - L = 65535737856 |
10 |
Partially correct |
240 ms |
57328 KB |
Output is partially correct - L = 65535737856 |
11 |
Partially correct |
254 ms |
57408 KB |
Output is partially correct - L = 65535737856 |
12 |
Partially correct |
243 ms |
57288 KB |
Output is partially correct - L = 65535737856 |
13 |
Partially correct |
274 ms |
56948 KB |
Output is partially correct - L = 65535737856 |
14 |
Partially correct |
284 ms |
56500 KB |
Output is partially correct - L = 65535737856 |
15 |
Correct |
128 ms |
31932 KB |
Output is correct - L = 183238656 |
16 |
Correct |
128 ms |
31948 KB |
Output is correct - L = 183238656 |
17 |
Correct |
135 ms |
32004 KB |
Output is correct - L = 183238656 |
18 |
Partially correct |
260 ms |
56524 KB |
Output is partially correct - L = 65535737856 |
19 |
Partially correct |
272 ms |
56852 KB |
Output is partially correct - L = 65535737856 |
20 |
Partially correct |
262 ms |
56492 KB |
Output is partially correct - L = 65535737856 |
21 |
Partially correct |
259 ms |
56652 KB |
Output is partially correct - L = 65535737856 |
22 |
Partially correct |
332 ms |
56532 KB |
Output is partially correct - L = 65535737856 |
23 |
Partially correct |
303 ms |
56464 KB |
Output is partially correct - L = 65535737856 |
24 |
Partially correct |
273 ms |
56616 KB |
Output is partially correct - L = 65535737856 |
25 |
Partially correct |
267 ms |
56476 KB |
Output is partially correct - L = 65535737856 |
26 |
Partially correct |
297 ms |
56384 KB |
Output is partially correct - L = 65535737856 |
27 |
Partially correct |
288 ms |
56408 KB |
Output is partially correct - L = 65535737856 |