# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
587635 | 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";
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++) {
answ += (T[i] == '1' ? 1 : 0) * (1<<(i - pos));
}
return answ;
} else {
pos += 14;
}
}
}
return answ;
}