# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
232802 | AlexLuchianov | Broken Device (JOI17_broken_device) | C++14 | 73 ms | 3072 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <iostream>
using ll = long long;
namespace Alice{
int const nmax = 150;
int const modulo = 1000000007;
int const base = 13;
int const rest = 7;
int block[1 + nmax];
int v[1 + nmax];
int root;
int myrand(){
root = (1LL * root * base + rest) % modulo;
return root;
}
void staticshuffle(int n){
for(int i = 0; i < n; i++)
v[i] = i;
for(int i = 0; i < 3 * n; i++){
int x = myrand() % n;
int y = myrand() % n;
std::swap(v[x], v[y]);
}
}
}
using namespace Alice;
void Anna( int n, long long X, int k, int P[] ){
root = 1;
staticshuffle(n);
for(int i = 0; i < k; i++)
block[P[i]] = 1;
for(int i = 0; i < n; i += 2){
if(X == 0 || block[v[i]] == 1 || block[v[i + 1]] == 1) {
Set(v[i], 0);
Set(v[i + 1], 0);
} else {
int number = X % 3 + 1;
X /= 3;
Set(v[i], (0 < (number & 2)));
Set(v[i + 1], (number & 1));
}
}
}
/*
2
150 14 1
2
150 9 2
0 1
*/
#include "Brunolib.h"
#include <iostream>
using ll = long long;
namespace Ban{
int const nmax = 150;
int const modulo = 1000000007;
int const base = 13;
int const rest = 7;
int v[1 + nmax];
int root;
int myrand(){
root = (1LL * root * base + rest) % modulo;
return root;
}
void staticshuffle(int n){
for(int i = 0; i < n; i++)
v[i] = i;
for(int i = 0; i < 3 * n; i++){
int x = myrand() % n;
int y = myrand() % n;
std::swap(v[x], v[y]);
}
}
}
using namespace Ban;
long long Bruno(int n, int A[] ){
root = 1;
staticshuffle(n);
ll result = 0;
for(int i = n - 2; 0 <= i; i -= 2){
if(A[v[i]] == 0 && A[v[i + 1]] == 0) {
continue;
} else {
int number = (v[i]<<1) + v[i + 1] - 1;
result = result * 3 + number;
}
}
return result;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |