#include<bits/stdc++.h>
#include "Ali.h"
#define MAXN 10007
using namespace std;
namespace{
int n,xx,yy;
bool dali;
vector<int> v[MAXN],w;
int dist[MAXN];
void dfs(int x,int p,int d){
dist[x]=d;
for(int i=0;i<v[x].size();i++){
if(v[x][i]==p)continue;
dfs(v[x][i],x,d+1);
}
}
}
void Init(int N, vector<int> U, vector<int> V){
n=N;
for(int i=0;i<n;i++)v[i].clear();
w.clear();
for(int i=0;i<n-1;i++){
v[U[i]].push_back(V[i]);
v[V[i]].push_back(U[i]);
if(U[i]==4039 and V[i]==9999)dali=true;
if(V[i]==4039 and U[i]==9999)dali=true;
}
for(int i=0;i<=n-1;i++){
SetID(i,i);
}
}
string SendA(string S){
xx=yy=0;
string res="";
for(int i=0;i<14;i++){
xx*=2;
if(S[i]=='1')xx++;
}
for(int i=0;i<6;i++){
yy*=2;
if(S[14+i]=='1')yy++;
}
for(int i=0;i<8;i++)yy*=2;
for(int i=0;i<=n-1;i++){
if(xx==i)continue;
//if((i^yy)>=(1<<8))continue;
w.push_back(i);
}
dfs(xx,-1,0);
for(int curr:w){
for(int i=13;i>=0;i--){
if(((1<<i)&curr)>0)res+="1";
else res+="0";
}
for(int i=13;i>=0;i--){
if(((1<<i)&dist[curr])>0)res+="1";
else res+="0";
}
}
return res;
}
#include<bits/stdc++.h>
#include "Benjamin.h"
#define MAXN 10007
using namespace std;
namespace{
int nn,from,to,s;
}
string SendB(int N, int X, int Y){
if(N>100)cout<<1/0;
nn=N; from=X; to=Y;
string res="";
for(int i=13;i>=0;i--){
if((from&(1<<i))==0)res.push_back('0');
else res.push_back('1');
}
for(int i=13;i>=8;i--){
if((to&(1<<i))==0)res.push_back('0');
else res.push_back('1');
}
return res;
}
int Answer(string T){
if(nn>100)cout<<1/0;
for(int i=0;i<T.size();i+=28){
s=0;
for(int f=i;f<i+14;f++){
s*=2;
if(T[f]=='1')s++;
}
if(s==to){
s=0;
for(int f=i+14;f<i+28;f++){
s*=2;
if(T[f]=='1')s++;
}
return s;
}
}
}
Compilation message
Ali.cpp: In function 'void {anonymous}::dfs(int, int, int)':
Ali.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | for(int i=0;i<v[x].size();i++){
| ~^~~~~~~~~~~~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
10 | char _randmem[12379];
| ^~~~~~~~
Benjamin.cpp: In function 'std::string SendB(int, int, int)':
Benjamin.cpp:12:21: warning: division by zero [-Wdiv-by-zero]
12 | if(N>100)cout<<1/0;
| ~^~
Benjamin.cpp: In function 'int Answer(std::string)':
Benjamin.cpp:31:22: warning: division by zero [-Wdiv-by-zero]
31 | if(nn>100)cout<<1/0;
| ~^~
Benjamin.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for(int i=0;i<T.size();i+=28){
| ~^~~~~~~~~
Benjamin.cpp:50:1: warning: control reaches end of non-void function [-Wreturn-type]
50 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1176 KB |
Output is correct |
2 |
Correct |
2 ms |
1176 KB |
Output is correct |
3 |
Correct |
0 ms |
1176 KB |
Output is correct |
4 |
Correct |
1 ms |
928 KB |
Output is correct |
5 |
Correct |
1 ms |
1176 KB |
Output is correct |
6 |
Failed |
5 ms |
1192 KB |
Unexpected end of file - int32 expected (Bruno) |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
1260 KB |
Output is partially correct |
2 |
Failed |
6 ms |
1000 KB |
Unexpected end of file - int32 expected (Bruno) |
3 |
Halted |
0 ms |
0 KB |
- |