Submission #990927

# Submission time Handle Problem Language Result Execution time Memory
990927 2024-05-31T20:00:36 Z MarwenElarbi Broken Device (JOI17_broken_device) C++17
45 / 100
25 ms 2900 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;
}
# Verdict Execution time Memory Grader output
1 Partially correct 20 ms 2396 KB Output is partially correct - L* = 19
2 Partially correct 23 ms 2620 KB Output is partially correct - L* = 17
3 Partially correct 23 ms 2396 KB Output is partially correct - L* = 17
4 Partially correct 20 ms 2372 KB Output is partially correct - L* = 19
5 Partially correct 23 ms 2456 KB Output is partially correct - L* = 17
6 Partially correct 20 ms 2488 KB Output is partially correct - L* = 17
7 Partially correct 23 ms 2404 KB Output is partially correct - L* = 18
8 Partially correct 23 ms 2900 KB Output is partially correct - L* = 17
9 Partially correct 23 ms 2484 KB Output is partially correct - L* = 18
10 Partially correct 20 ms 2400 KB Output is partially correct - L* = 18
11 Partially correct 22 ms 2396 KB Output is partially correct - L* = 19
12 Partially correct 20 ms 2392 KB Output is partially correct - L* = 17
13 Partially correct 22 ms 2392 KB Output is partially correct - L* = 17
14 Partially correct 20 ms 2680 KB Output is partially correct - L* = 18
15 Partially correct 20 ms 2396 KB Output is partially correct - L* = 18
16 Partially correct 22 ms 2836 KB Output is partially correct - L* = 17
17 Partially correct 22 ms 2392 KB Output is partially correct - L* = 17
18 Partially correct 22 ms 2476 KB Output is partially correct - L* = 18
19 Partially correct 23 ms 2396 KB Output is partially correct - L* = 18
20 Partially correct 22 ms 2392 KB Output is partially correct - L* = 19
21 Partially correct 20 ms 2372 KB Output is partially correct - L* = 18
22 Partially correct 23 ms 2404 KB Output is partially correct - L* = 18
23 Partially correct 20 ms 2404 KB Output is partially correct - L* = 19
24 Partially correct 20 ms 2652 KB Output is partially correct - L* = 17
25 Partially correct 25 ms 2428 KB Output is partially correct - L* = 18
26 Partially correct 20 ms 2524 KB Output is partially correct - L* = 18
27 Partially correct 22 ms 2476 KB Output is partially correct - L* = 18
28 Partially correct 22 ms 2592 KB Output is partially correct - L* = 18
29 Partially correct 23 ms 2376 KB Output is partially correct - L* = 18
30 Partially correct 20 ms 2396 KB Output is partially correct - L* = 19
31 Partially correct 20 ms 2388 KB Output is partially correct - L* = 19
32 Partially correct 20 ms 2396 KB Output is partially correct - L* = 17
33 Partially correct 20 ms 2396 KB Output is partially correct - L* = 18
34 Partially correct 20 ms 2396 KB Output is partially correct - L* = 17
35 Partially correct 20 ms 2404 KB Output is partially correct - L* = 19
36 Partially correct 20 ms 2392 KB Output is partially correct - L* = 18
37 Partially correct 20 ms 2388 KB Output is partially correct - L* = 17
38 Partially correct 22 ms 2392 KB Output is partially correct - L* = 18
39 Partially correct 20 ms 2480 KB Output is partially correct - L* = 17
40 Partially correct 20 ms 2632 KB Output is partially correct - L* = 18