답안 #1064348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1064348 2024-08-18T11:46:53 Z Unforgettablepl Broken Device (JOI17_broken_device) C++17
85 / 100
30 ms 3008 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

namespace {
vector<int> convert_to_base3(long long x) {
    vector<int> res;
    while(x) {
        res.emplace_back(x%3);
        x/=3;
    }
    return res;
}
}

void Anna(int N, long long X, int K, int P[]){
    vector<bool> bad(N+1);
    for(int i=0;i<K;i++)bad[P[i]]=true;
    vector<int> num = convert_to_base3(X);
    auto iter = num.begin();
    for(int i=0;i<N;i+=2) {
        if(bad[i] or bad[i+1] or iter==num.end()){Set(i,0);Set(i+1,0);continue;}
        if(*iter==0){
            Set(i,0);
            Set(i+1,1);
        } else if(*iter==1) {
            Set(i,1);
            Set(i+1,0);
        } else if(*iter==2) {
            Set(i,1);
            Set(i+1,1);
        }
        iter++;
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

namespace {
long long convert_to_base2(vector<int> num) {
    long long X = 0;
    reverse(num.begin(),num.end());
    for(int&i:num) {
        X*=3;
        X+=i;
    }
    return X;
}
}

long long Bruno(int N, int A[]) {
    vector<int> num;
    for(int i=0;i<N;i+=2){
        if(A[i]==0 and A[i+1]==1)num.emplace_back(0);
        else if(A[i]==1 and A[i+1]==0)num.emplace_back(1);
        else if(A[i]==1 and A[i+1]==1)num.emplace_back(2);
    }
    return convert_to_base2(num);
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37
2 Partially correct 23 ms 2888 KB Output is partially correct - L* = 37
3 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37
4 Partially correct 20 ms 2820 KB Output is partially correct - L* = 37
5 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37
6 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37
7 Partially correct 25 ms 3008 KB Output is partially correct - L* = 37
8 Partially correct 23 ms 2776 KB Output is partially correct - L* = 37
9 Partially correct 22 ms 2772 KB Output is partially correct - L* = 37
10 Partially correct 23 ms 2780 KB Output is partially correct - L* = 37
11 Partially correct 22 ms 2752 KB Output is partially correct - L* = 37
12 Partially correct 25 ms 2852 KB Output is partially correct - L* = 37
13 Partially correct 29 ms 2676 KB Output is partially correct - L* = 37
14 Partially correct 24 ms 2744 KB Output is partially correct - L* = 37
15 Partially correct 26 ms 2780 KB Output is partially correct - L* = 37
16 Partially correct 22 ms 2752 KB Output is partially correct - L* = 37
17 Partially correct 23 ms 2768 KB Output is partially correct - L* = 37
18 Partially correct 20 ms 2828 KB Output is partially correct - L* = 37
19 Partially correct 22 ms 2688 KB Output is partially correct - L* = 37
20 Partially correct 22 ms 2784 KB Output is partially correct - L* = 37
21 Partially correct 23 ms 2764 KB Output is partially correct - L* = 37
22 Partially correct 22 ms 2856 KB Output is partially correct - L* = 37
23 Partially correct 30 ms 2752 KB Output is partially correct - L* = 37
24 Partially correct 20 ms 2860 KB Output is partially correct - L* = 37
25 Partially correct 22 ms 2784 KB Output is partially correct - L* = 37
26 Partially correct 25 ms 2780 KB Output is partially correct - L* = 37
27 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37
28 Partially correct 22 ms 2772 KB Output is partially correct - L* = 37
29 Partially correct 20 ms 2872 KB Output is partially correct - L* = 37
30 Partially correct 20 ms 2776 KB Output is partially correct - L* = 37
31 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37
32 Partially correct 22 ms 2748 KB Output is partially correct - L* = 37
33 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37
34 Partially correct 22 ms 2748 KB Output is partially correct - L* = 37
35 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37
36 Partially correct 24 ms 2776 KB Output is partially correct - L* = 37
37 Partially correct 24 ms 2776 KB Output is partially correct - L* = 37
38 Partially correct 20 ms 2744 KB Output is partially correct - L* = 37
39 Partially correct 23 ms 2816 KB Output is partially correct - L* = 37
40 Partially correct 23 ms 2776 KB Output is partially correct - L* = 37