# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
679164 | pashka | Broken Device (JOI17_broken_device) | C++14 | 27 ms | 2668 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 "Annalib.h"
#include<vector>
#include<string>
#include<iostream>
using namespace std;
const int N = 150;
const int M = 60;
const long long XOR = 0x341231365237683ll;
const int P[150] = {4, 28, 118, 69, 138, 85, 30, 65, 63, 35, 132, 146, 56, 10, 95, 74, 64, 70, 125, 128, 124, 39, 120,
111, 80, 29, 16, 60, 53, 100, 26, 136, 106, 143, 137, 76, 123, 45, 37, 33, 130, 3, 2, 59, 99, 142,
145, 97, 68, 83, 127, 58, 38, 1, 62, 114, 43, 101, 22, 141, 103, 131, 110, 18, 61, 49, 115, 0, 5,
135, 15, 13, 86, 34, 105, 72, 9, 7, 126, 88, 77, 41, 17, 51, 133, 50, 81, 112, 116, 67, 96, 24, 148,
117, 84, 102, 144, 19, 92, 121, 25, 8, 75, 52, 93, 73, 149, 6, 20, 48, 104, 66, 12, 57, 91, 147, 90,
82, 98, 27, 21, 139, 129, 108, 44, 31, 89, 134, 14, 87, 32, 71, 55, 122, 23, 79, 36, 109, 78, 113,
119, 47, 107, 54, 42, 40, 46, 11, 140, 94};
void Anna(int n, long long x, int k, int p[]) {
x = x ^ XOR;
vector<int> res(N);
string s;
for (int i = 0; i < 60; i++) {
s += to_string((x >> i) & 1);
}
vector<bool> z(N);
for (int i = 0; i < k; i++) z[p[i]] = true;
bool st = false;
int j = 0;
for (int i = 0; i < N; i++) {
if (z[i] || j == (int) s.size()) {
st = !st;
continue;
}
if ((s[j] == '0' && !st) || (s[j] == '1' && st)) {
res[i] = 1;
j++;
} else {
st = !st;
}
}
cout << s << " " << x << "\n";
for (int i = 0; i < N; i++) {
// Set(i, res[P[i]]);
Set(i, res[i]);
}
}
#include "Brunolib.h"
#include<vector>
#include<string>
#include<iostream>
using namespace std;
const int N = 150;
const int M = 60;
const long long XOR = 0x341231365237683ll;
const int P[150] = {4, 28, 118, 69, 138, 85, 30, 65, 63, 35, 132, 146, 56, 10, 95, 74, 64, 70, 125, 128, 124, 39, 120,
111, 80, 29, 16, 60, 53, 100, 26, 136, 106, 143, 137, 76, 123, 45, 37, 33, 130, 3, 2, 59, 99, 142,
145, 97, 68, 83, 127, 58, 38, 1, 62, 114, 43, 101, 22, 141, 103, 131, 110, 18, 61, 49, 115, 0, 5,
135, 15, 13, 86, 34, 105, 72, 9, 7, 126, 88, 77, 41, 17, 51, 133, 50, 81, 112, 116, 67, 96, 24, 148,
117, 84, 102, 144, 19, 92, 121, 25, 8, 75, 52, 93, 73, 149, 6, 20, 48, 104, 66, 12, 57, 91, 147, 90,
82, 98, 27, 21, 139, 129, 108, 44, 31, 89, 134, 14, 87, 32, 71, 55, 122, 23, 79, 36, 109, 78, 113,
119, 47, 107, 54, 42, 40, 46, 11, 140, 94};
long long Bruno(int n, int A[]) {
vector<int> a(N);
for (int i = 0; i < N; i++) {
// a[P[i]] = A[i];
a[i] = A[i];
}
long long x = 0;
bool st = false;
int j = 0;
string s;
for (int i = 0; i < N; i++) {
if (a[i]) {
s += to_string(st);
if (st)
x = x | (1ll << j);
j++;
if (j == M) break;
} else {
st = !st;
}
}
cout << s << " " << x << "\n";
x = x ^ XOR;
return x;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |