답안 #990926

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
990926 2024-05-31T19:59:56 Z MarwenElarbi Broken Device (JOI17_broken_device) C++17
0 / 100
28 ms 2620 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
    vector<int> arr1={ 26, 96, 8, 126, 85, 103, 1, 58, 75, 17, 120, 141, 114, 74, 19, 56, 34, 123, 9, 137, 3, 2, 68, 50, 64, 32, 138, 113, 49, 118, 101, 108, 15, 35, 59, 107, 146, 79, 117, 10, 51, 57, 27, 148, 53, 133, 140, 129, 73, 139, 92, 69, 62, 86, 23, 142, 80, 78, 70, 45, 87, 89, 31, 40, 128, 99, 116, 102, 106, 16, 125, 66, 14, 4, 100 }; 
    vector<int> arr2={ 12, 7, 44, 98, 72, 71, 82, 93, 28, 147, 88, 42, 127, 105, 47, 24, 112, 13, 30, 149, 132, 0, 94, 136, 145, 134, 97, 11, 135, 77, 63, 25, 20, 36, 54, 76, 38, 143, 22, 90, 46, 84, 130, 122, 65, 81, 41, 18, 55, 33, 21, 61, 121, 109, 144, 124, 39, 119, 67, 5, 115, 48, 43, 131, 91, 37, 104, 6, 52, 110, 95, 29, 111, 83, 60 } ;
    int tab[N];
    memset(tab,0,sizeof tab);
    for (int i = 0; i < K; ++i)
    {
        tab[P[i]]=-1;
    }
    int convert[60];
    long long a[60];
    a[0]=1;
    for (int i = 1; i < 60; ++i)
    {
        a[i]=a[i-1]*2;
    }
    long long y=59;
    //cout << a[59]<<endl;
    while(y>=0){
        //cout <<X<<" "<<a[y]<<endl;
        if(X>=a[y]){
            X-=a[y];
            convert[y]=1;
        }else convert[y]=0;
        y--;
    }//cout <<endl;
    int lst=0;
    for (int i = 0; i < 75; i++)
    {
        if(lst>59) break;
        if(convert[lst]==1){
            if (tab[arr1[i]]!=-1&&tab[arr2[i]]!=-1)
            {
                tab[arr1[i]]=1;
                tab[arr2[i]]=1;
                lst++;
            }
        }else{
            if (tab[arr1[i]]!=-1&&tab[arr2[i]]!=-1)
            {
                tab[arr1[i]]=0;
                tab[arr2[i]]=1;
                lst++;
            }else if (tab[arr1[i]]!=-1)
            {
                tab[arr1[i]]=1;
                tab[arr2[i]]=0;
                lst++;
            }else if(tab[arr2[i]]!=-1){
                tab[arr2[i]]=1;
                tab[arr1[i]]=0;
                lst++;
            }
        }
    }
    for (int i = 0; i < N; ++i)
    {
        if(tab[i]==1) Set(i,1);
        else Set(i,0);
    }
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
long long Bruno( int N, int A[] ){
    vector<int> arr1={ 26, 96, 8, 126, 85, 103, 1, 58, 75, 17, 120, 141, 114, 74, 19, 56, 34, 123, 9, 137, 3, 2, 68, 50, 64, 32, 138, 113, 49, 118, 101, 108, 15, 35, 59, 107, 146, 79, 117, 10, 51, 57, 27, 148, 53, 133, 140, 129, 73, 139, 92, 69, 62, 86, 23, 142, 80, 78, 70, 45, 87, 89, 31, 40, 128, 99, 116, 102, 106, 16, 125, 66, 14, 4, 100 }; 
    vector<int> arr2={ 12, 7, 44, 98, 72, 71, 82, 93, 28, 147, 88, 42, 127, 105, 47, 24, 112, 13, 30, 149, 132, 0, 94, 136, 145, 134, 97, 11, 135, 77, 63, 25, 20, 36, 54, 76, 38, 143, 22, 90, 46, 84, 130, 122, 65, 81, 41, 18, 55, 33, 21, 61, 121, 109, 144, 124, 39, 119, 67, 5, 115, 48, 43, 131, 91, 37, 104, 6, 52, 110, 95, 29, 111, 83, 60 } ;
    int lst=0;
    long long x=0;
    long long a[60];
    a[0]=1;
    for (int i = 1; i < 60; ++i)
    {
        a[i]=a[i-1]*2;
        //cout <<a[i]<<endl;
    }
    for (int i = 0; i < 75; i++)
    {
        if(lst>59) break;
        if(A[arr1[i]]==1&&A[arr2[i]]==1){
            x+=a[lst];
            lst++;
        }else if(A[arr1[i]]==1||A[arr2[i]]==1){
            lst++;
        }
    }
    cout <<x<<endl;
    return x;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
2 Incorrect 25 ms 2400 KB Program terminated incorrectly, or you printed something to stdout
3 Incorrect 26 ms 2400 KB Program terminated incorrectly, or you printed something to stdout
4 Incorrect 26 ms 2368 KB Program terminated incorrectly, or you printed something to stdout
5 Incorrect 26 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
6 Incorrect 26 ms 2332 KB Program terminated incorrectly, or you printed something to stdout
7 Incorrect 27 ms 2304 KB Program terminated incorrectly, or you printed something to stdout
8 Incorrect 27 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
9 Incorrect 26 ms 2604 KB Program terminated incorrectly, or you printed something to stdout
10 Incorrect 26 ms 2400 KB Program terminated incorrectly, or you printed something to stdout
11 Incorrect 26 ms 2620 KB Program terminated incorrectly, or you printed something to stdout
12 Incorrect 26 ms 2500 KB Program terminated incorrectly, or you printed something to stdout
13 Incorrect 26 ms 2380 KB Program terminated incorrectly, or you printed something to stdout
14 Incorrect 27 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
15 Incorrect 27 ms 2328 KB Program terminated incorrectly, or you printed something to stdout
16 Incorrect 26 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
17 Incorrect 26 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
18 Incorrect 27 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
19 Incorrect 26 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
20 Incorrect 27 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
21 Incorrect 26 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
22 Incorrect 28 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
23 Incorrect 27 ms 2588 KB Program terminated incorrectly, or you printed something to stdout
24 Incorrect 27 ms 2404 KB Program terminated incorrectly, or you printed something to stdout
25 Incorrect 27 ms 2492 KB Program terminated incorrectly, or you printed something to stdout
26 Incorrect 26 ms 2388 KB Program terminated incorrectly, or you printed something to stdout
27 Incorrect 26 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
28 Incorrect 26 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
29 Incorrect 26 ms 2436 KB Program terminated incorrectly, or you printed something to stdout
30 Incorrect 26 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
31 Incorrect 26 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
32 Incorrect 26 ms 2496 KB Program terminated incorrectly, or you printed something to stdout
33 Incorrect 26 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
34 Incorrect 26 ms 2496 KB Program terminated incorrectly, or you printed something to stdout
35 Incorrect 26 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
36 Incorrect 28 ms 2400 KB Program terminated incorrectly, or you printed something to stdout
37 Incorrect 26 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
38 Incorrect 26 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
39 Incorrect 26 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
40 Incorrect 26 ms 2304 KB Program terminated incorrectly, or you printed something to stdout