#include "Ali.h"
#include <string>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
pair<ll,ll> p[110000];
ll x,y,n,i,j;
void Init(int N, std::vector<int> U, std::vector<int> V) {
ll i;
n=N;
for(i=0;i<N;i++)
SetID(i,i);
for(i=0;i<(n-1);i++)
{
p[i]={U[i],V[i]};
}
}
string s;
string SendA(string S) {
for(i=0;i<(n-1);i++)
{
x=p[i].first;
y=8192;
for(j=0;j<15;j++)
{
if(x/y%2==0)
s+="0";
else
s+="1";
y/=2;
}
y=8192;
x=p[i].second;
for(j=0;j<15;j++)
{
if(x/y%2==0)
s+="0";
else
s+="1";
y/=2;
}
}
return s;
}
#include "Benjamin.h"
#include <string>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
ll x,y,n,k,z,w,h[110000],i,j;
vector<ll> v[110000];
string SendB(int N, int X, int Y) {
x=X; y=Y; n=N;
return "00000111110000011111";
}
string s;
ll f(ll x,ll z)
{
ll i,w;
for(i=0;i<h[x];i++)
{
if(v[x][i]==z)
continue;
w=f(v[x][i],x);
if(w!=-1)
return w+1;
}
return -1;
}
int Answer(string T) {
s=T;
for(i=0;i<(n-1);i++)
{
z=0;
for(j=0;j<15;j++)
{
z=z*2+s[i*30+j]-'0';
}
w=0;
for(j=0;j<15;j++)
{
w=w*2+s[i*30+15+j]-'0';
}
v[z].push_back(w);
v[w].push_back(z);
}
for(i=0;i<n;i++)
h[i]=v[i].size();
return f(x,-1);
}
Compilation message
Ali.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>)':
Ali.cpp:12:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
12 | for(i=0;i<N;i++)
| ^~~
Ali.cpp:14:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
14 | for(i=0;i<(n-1);i++)
| ^~~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
10 | char _randmem[12379];
| ^~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 8 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 8 |
2 |
Halted |
0 ms |
0 KB |
- |