# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
21540 | Ushio | Broken Device (JOI17_broken_device) | C++14 | 75 ms | 4644 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
vector<int> per(N + 1);
srand(241417941L);
for (int i = 0; i < N + 1; ++i) {
per[i] = i;
}
for (int i = 0; i < N; ++i) {
int pos = i + rand() % (N - i);
swap(per[i], per[pos]);
}
int bit = 0;
bool validity = true;
vector<bool> bad(N + 1, false);
bad[per[N]] = true;
for (int i = 0; i < K; ++i) {
bad[P[i]] = true;
}
for (int i = 0; i < N; ++i) {
if (validity) {
if (bad[per[i]] || (bad[per[i + 1]] && bit <= 59 && (X & (1LL << bit)))) {
Set(per[i], 0);
validity = true;
} else {
Set(per[i], 1);
validity = false;
}
} else {
if (bit <= 59) {
if (X & (1LL << bit)) {
Set(per[i], 1);
} else {
Set(per[i], 0);
}
bit++;
} else {
Set(per[i], 0);
}
validity = true;
}
}
cerr << "In: " << X << endl;
}
#include "Brunolib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
long long Bruno( int N, int A[] ){
vector<int> per(N + 1);
srand(241417941L);
for (int i = 0; i < N + 1; ++i) {
per[i] = i;
}
for (int i = 0; i < N; ++i) {
int pos = i + rand() % (N - i);
swap(per[i], per[pos]);
}
bool validity = true;
int bit = 0;
int64_t ans = 0;
for (int i = 0; i < N; ++i) {
if (validity) {
validity = A[per[i]] == 0;
} else {
if (bit <= 59) {
ans |= ((int64_t) A[per[i]]) << bit;
++bit;
}
validity = true;
}
}
cerr << "Out: " << ans << endl;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |