# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
55066 | spencercompton | Broken Device (JOI17_broken_device) | C++17 | 140 ms | 3936 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string tostr(ll x){
string ret = "";
for(int i = 0; i<60; i++){
if((x&(1LL<<i))!=0){
ret += "1";
}
else{
ret += "0";
}
}
return ret;
}
void Anna( int N, long long X, int K, int P[] ){
srand(69);
vector<int> rands;
bool res[N];
for(int i = 0; i<N; i++){
res[i] = false;
}
for(int i = 0; i<1000; i++){
rands.push_back(rand()%2);
}
for(int i = 0; i<K; i++){
res[P[i]] = true;
}
string str = tostr(X);
int pos = 0;
int cur = 0;
// if rands[i] = 0, 10 = 00, 11 = 01, 01 = 1
for(int i = 0; i<N && pos<60; i+=2){
if(res[i] || res[i+1]){
continue;
}
cur++;
if(pos==59){
if(str[pos]=='0'){
res[i] = false;
res[i+1] = true;
}
else{
res[i] = true;
res[i+1] = true;
}
pos++;
break;
}
if(str[pos]-'0'==rands[cur]){
res[i] = true;
if(str[pos+1]-'0'==rands[cur]){
res[i+1] = true;
}
else{
res[i+1] = false;
}
pos += 2;
}
else{
res[i] = false;
res[i+1] = true;
pos++;
}
}
for(int i = 0; i<N; i++){
Set(i,res[i]?1:0);
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll fromstr(string s){
ll ret = 0LL;
for(int i = 0; i<60; i++){
if(s[i]=='1'){
ret += (1LL<<i);
}
}
return ret;
}
long long Bruno( int N, int A[] ){
srand(69);
vector<int> rands;
for(int i = 0; i<1000; i++){
rands.push_back(rand()%2);
}
string str = "";
int pos = 0;
int cur = 0;
// if rands[i] = 0, 10 = 00, 11 = 01, 01 = 1
for(int i = 0; i<N && (int)str.length()<60; i+=2){
if(A[i]==0 && A[i+1]==0){
continue;
}
cur++;
if((int)str.length()==59){
if(A[i]==0){
str += "0";
}
else{
str += "1";
}
break;
}
if(A[i]==1){
str += (char)(rands[cur]+'0');
if(A[i+1]==1){
str += (char)(rands[cur]+'0');
}
else{
str += (char)((1-rands[cur])+'0');
}
}
else{
str += (char)((1-rands[cur])+'0');
}
}
return fromstr(str);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |