#include "Ali.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pb push_back
const int M=10001;
const ll inf=1e9+10;
vii adj[M];
ll id[M],dis[M];
ll t=0;
ll n;
vii v;
void dfs(ll x,ll pa){
id[x]=t++;
for(auto it:adj[x]){
if(it==pa)
continue;
dfs(it,x);
}
}
string res;
void ord(ll x,ll pa=-1,ll d=0){
dis[x]=d;
for(auto it:adj[x]){
if(it==pa)
continue;
ord(it,x,d+1);
}
}
void Init(int N, std::vector<int> U, std::vector<int> V) {
n=N;
for(int i=0;i<n;i++)
adj[i].clear();
for(int i=0;i<n-1;i++)
adj[U[i]].pb(V[i]),adj[V[i]].pb(U[i]);
dfs(0,-1);
for(int i=0;i<n;i++)
SetID(i,i);
}
string encode(ll x){
string res;
for(int i=0;i<14;i++){
if((x&(1<<i))>0)
res.pb('1');
else
res.pb('0');
}
return res;
}
std::string SendA(std::string S){
res.clear();
v.clear();
v.pb(0);
v.pb((1<<10));
v.pb((1<<11));
v.pb((1<<10)+(1<<11));
v.pb((1<<12));
v.pb((1<<12)+(1<<10));
v.pb((1<<12)+(1<<11));
v.pb((1<<12)+(1<<11)+(1<<10));
v.pb((1<<13));
v.pb((1<<13)+(1<<10));
ll a=0,b=0;
for(int i=0;i<10;i++)
a+=(1<<i)*(S[i]=='1');
for(int i=10;i<20;i++)
b+=(1<<(i-10))*(S[i]=='1');
for(auto it:v){
for(int i=0;i<n;i++)
dis[i]=0;
ord(a+it,-1);
for(auto itt:v){
res+=encode(dis[b+itt]);
}
}
return res;
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pb push_back
namespace {
const ll M=1e5;
const ll inf=1e18;
ll n,x,y,pa[M],dis[M];
vii adj[M];
vii v;
void dfs(ll x,ll pa=-1,ll d=0){
dis[x]=d;
for(auto it:adj[x]){
if(it==pa)
continue;
dfs(it,x,d+1);
}
}
}
std::string SendB(int N, int X, int Y) {
n=N,x=X,y=Y;
string r;
for(int i=0;i<10;i++){
if((x&(1<<i))>0)
r+='1';
else
r+='0';
}
for(int i=0;i<10;i++){
if((y&(1<<i))>0)
r+='1';
else
r+='0';
}
return r;
}
int Answer(std::string T) {
ll xx,yy;
xx=0,yy=0;
v.clear();
v.pb(0);
v.pb((1<<10));
v.pb((1<<11));
v.pb((1<<10)+(1<<11));
v.pb((1<<12));
v.pb((1<<12)+(1<<10));
v.pb((1<<12)+(1<<11));
v.pb((1<<12)+(1<<11)+(1<<10));
v.pb((1<<13));
v.pb((1<<13)+(1<<10));
for(int i=0;i<10;i++){
if((x&(1<<i)))
xx+=(1<<i);
if((y&(1<<i)))
yy+=(1<<i);
}
ll ans=0;
ll ind=0;
bool chk=0;
for(int i=0;i<10;i++){
if(chk)
break;
for(int j=0;j<10;j++){
if(xx+v[i]==x&&yy+v[i]==y)
chk=1;
break;
ind+=14;
}
}
for(int i=ind;i<ind+14;i++){
ans+=(1<<(i-ind))*(T[i]=='1');
}
return ans;
}
/*
g++ -std=c++17 -O2 -o grader grader.cpp Ali.cpp Benjamin.cpp
*/
Compilation message
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
10 | char _randmem[12379];
| ^~~~~~~~
Benjamin.cpp:14:12: warning: '{anonymous}::pa' defined but not used [-Wunused-variable]
14 | ll n,x,y,pa[M],dis[M];
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
3224 KB |
Output is correct |
2 |
Correct |
2 ms |
3224 KB |
Output is correct |
3 |
Correct |
2 ms |
3224 KB |
Output is correct |
4 |
Correct |
2 ms |
3224 KB |
Output is correct |
5 |
Correct |
1 ms |
3224 KB |
Output is correct |
6 |
Incorrect |
6 ms |
1292 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
3224 KB |
Output is partially correct |
2 |
Incorrect |
5 ms |
1352 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |