# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
587648 | LastRonin | Flights (JOI22_flights) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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";
//if(a.size() == 20)exit(0);
return a;
}
int Answer(std::string T) {
int sub = ((1<<6) - 1)&y;
int pos = 0;
int 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;
}
// }
}
return 0;
}
#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";
//if(a.size() == 20)exit(0);
return a;
}
int Answer(std::string T) {
int sub = ((1<<6) - 1)&y;
int pos = 0;
int 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[i] == '1')
answ += (1ll<<(i - pos));
}
return answ;
} else {
pos += 14;
}
// }
}
return 0;
}