# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770367 | Plurm | 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>
using namespace std;
namespace {
const int MODX = 1024;
const int MODY = 1024;
int N, X, Y;
} // namespace
std::string SendB(int N, int X, int Y) {
::N = N;
::X = X;
::Y = Y;
int mx = X % MODX;
int my = Y % MODY;
std::string msg;
for (int i = 0; i < 10; i++) {
if (mx & (1 << i))
msg.push_back('1');
else
msg.push_back('0');
}
for (int i = 0; i < 10; i++) {
if (my & (1 << i))
msg.push_back('1');
else
msg.push_back('0');
}
return msg;
}
int Answer(std::string T) {
int mx = X % MODX;
int my = Y % MODY;
int c = 0;
for (int i = 0; i < N; i++)
if (i % MODY == my)
c++;
int idx = X / MODX * c + Y / MODY;
int d = 0;
for (int i = 0; i < 14; i++) {
if (T[idx + i] == '1')
d |= 1 << i;
}
return d;
}
#include "Benjamin.h"
#include <string>
#include <vector>
using namespace std;
namespace {
const int MODX = 1024;
const int MODY = 1024;
int N, X, Y;
} // namespace
std::string SendB(int N, int X, int Y) {
::N = N;
::X = X;
::Y = Y;
int mx = X % MODX;
int my = Y % MODY;
std::string msg;
for (int i = 0; i < 10; i++) {
if (mx & (1 << i))
msg.push_back('1');
else
msg.push_back('0');
}
for (int i = 0; i < 10; i++) {
if (my & (1 << i))
msg.push_back('1');
else
msg.push_back('0');
}
return msg;
}
int Answer(std::string T) {
int mx = X % MODX;
int my = Y % MODY;
int idx = X / MODX * ((N - my + MODY - 1) / MODY) + Y / MODY;
int d = 0;
for (int i = 0; i < 14; i++) {
if (T[idx + i] == '1')
d |= 1 << i;
}
return d;
}