#include "Ali.h"
#include <string>
#include <vector>
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const ll N = 1e4 + 10;
namespace {
vector<ll> g[N];
ll dist[N] = {0};
ll n;
void dfs(ll v, ll p) {
for(auto u : g[v]) {
if(u != p) {
dist[u] = dist[v] + 1;
dfs(u, v);
}
}
}
}
void Init(int N, std::vector<int> U, std::vector<int> V) {
n = N;
for(int j = 0; j < n; j++)
g[j].clear();
for(int j = 0; j < U.size(); j++) {
g[U[j]].pb(V[j]);
g[V[j]].pb(U[j]);
}
for(int i = 0; i < N; i++)
SetID(i, i);
}
std::string SendA(std::string S) {
ll v = 0, u = 0;
for(int j = 0; j <= 13; j++) {
if(S[j] == '1')
v += (1<<j);
}
for(int j = 14; j < 20; j++) {
if(S[j] == '1')
u += (1<<(j - 14));
}
for(int i = 0; i < n; i++)
dist[i] = 0;
dfs(v, -1);
string a;
for(int j = 0; j < n; j++) {
if((j&u) == u) {
for(int i = 0; i < 14; i++) {
if((1ll<<i)&dist[j])a += "1";
else a += "0";
}
}
}
return a;
}
#include "Benjamin.h"
#include <string>
#include <vector>
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
namespace {
int n, x, y;
}
std::string SendB(int N, int X, int Y) {
x = X;
y = Y;
n = N;
string a;
for(int j = 0; j < 14; j++) {
if((1<<j)&x)a += "1";
else a += "0";
}
for(int j = 0; j < 6; j++)
if((1<<j)&y) a += "1";
else a += "0";
return a;
}
int Answer(std::string T) {
int sub = ((1<<6) - 1)&y;
ll pos = 0;
ll answ = 0;
for(int j = 0; j < n; j++) {
if((j&sub) == sub) {
if(j == y) {
for(int i = pos; i < pos + 14; i++) {
if(T.size() <= i)exit(0);
answ += (T[i] == '1' ? 1 : 0) * (1<<(i - pos));
}
return answ;
} else {
pos += 14;
}
}
}
exit(0);
return answ;
}
Compilation message
Ali.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>)':
Ali.cpp:30:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | for(int j = 0; j < U.size(); j++) {
| ~~^~~~~~~~~~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
10 | char _randmem[12379];
| ^~~~~~~~
Benjamin.cpp: In function 'int Answer(std::string)':
Benjamin.cpp:37:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
37 | if(T.size() <= i)exit(0);
| ~~~~~~~~~^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
736 KB |
Output is correct |
2 |
Correct |
2 ms |
712 KB |
Output is correct |
3 |
Correct |
1 ms |
748 KB |
Output is correct |
4 |
Correct |
0 ms |
656 KB |
Output is correct |
5 |
Correct |
1 ms |
656 KB |
Output is correct |
6 |
Correct |
7 ms |
1376 KB |
Output is correct |
7 |
Failed |
5 ms |
1160 KB |
Unexpected end of file - int32 expected (Bruno) |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
656 KB |
Output is partially correct |
2 |
Failed |
8 ms |
1184 KB |
Unexpected end of file - int32 expected (Bruno) |
3 |
Halted |
0 ms |
0 KB |
- |