# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
934118 |
2024-02-26T19:59:28 Z |
Saul0906 |
City (JOI17_city) |
C++14 |
|
296 ms |
43956 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=abs(tout[i]-125000);
x<<=17;
x+=abs(tin[i]-125000);
x^=(ll)(tin[i]<=125000)<<34;
x^=(ll)(tout[i]<=125000)<<34;
if(tin[i]==tout[i] && tin[i]<=125000) x|=(ll)(tout[i]<=125000)<<34;
//cout<<i<<" "<<x<<" "<<(abs(tin[i]-125000))<<" "<<(abs(tout[i]-125000))<<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<<17;
int Answer(ll S, ll T){
ll a, b, c, d;
a=(S%md);
S>>=17;
b=(S%md);
S>>=17;
if(S&1){
if(a!=b){
a=125000-a;
b=125000+b;
}else{
a=125000-a;
b=125000-b;
}
}else{
if(a>b){
a=125000-a;
b=125000-b;
}else{
a=125000+a;
b=125000+b;
}
}
c=(T%md);
T>>=17;
d=(T%md);
T>>=17;
if(T&1){
if(c!=d){
c=125000-c;
d=125000+d;
}else{
c=125000-c;
d=125000-d;
}
}else{
if(c>d){
c=125000-c;
d=125000-d;
}else{
c=125000+c;
d=125000+d;
}
}
if(a<=c && d<=b) return 1;
if(c<=a && b<=d) return 0;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
17424 KB |
Output is correct |
2 |
Correct |
3 ms |
17420 KB |
Output is correct |
3 |
Correct |
3 ms |
17520 KB |
Output is correct |
4 |
Correct |
3 ms |
17436 KB |
Output is correct |
5 |
Correct |
4 ms |
17416 KB |
Output is correct |
6 |
Correct |
4 ms |
17932 KB |
Output is correct |
7 |
Correct |
4 ms |
17424 KB |
Output is correct |
8 |
Correct |
4 ms |
17432 KB |
Output is correct |
9 |
Correct |
4 ms |
17436 KB |
Output is correct |
10 |
Correct |
3 ms |
17420 KB |
Output is correct |
11 |
Correct |
4 ms |
17436 KB |
Output is correct |
12 |
Correct |
3 ms |
17424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
125 ms |
24948 KB |
Output is partially correct - L = 33563994184 |
2 |
Partially correct |
126 ms |
24992 KB |
Output is partially correct - L = 33563994184 |
3 |
Partially correct |
127 ms |
25000 KB |
Output is partially correct - L = 33563994184 |
4 |
Partially correct |
125 ms |
24980 KB |
Output is partially correct - L = 33563994184 |
5 |
Partially correct |
286 ms |
43100 KB |
Output is partially correct - L = 33563994184 |
6 |
Partially correct |
296 ms |
43244 KB |
Output is partially correct - L = 33563994184 |
7 |
Partially correct |
286 ms |
42932 KB |
Output is partially correct - L = 33563994184 |
8 |
Partially correct |
274 ms |
42628 KB |
Output is partially correct - L = 33563994184 |
9 |
Partially correct |
271 ms |
43720 KB |
Output is partially correct - L = 33563994184 |
10 |
Partially correct |
260 ms |
43776 KB |
Output is partially correct - L = 33563994184 |
11 |
Partially correct |
252 ms |
43844 KB |
Output is partially correct - L = 33563994184 |
12 |
Incorrect |
273 ms |
43956 KB |
Wrong Answer [6] |
13 |
Halted |
0 ms |
0 KB |
- |