Submission #991263

# Submission time Handle Problem Language Result Execution time Memory
991263 2024-06-01T16:41:38 Z MarwenElarbi Broken Device (JOI17_broken_device) C++17
100 / 100
26 ms 2736 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
    vector<int> arr={ 141, 63, 142, 41, 134, 15, 110, 115, 2, 70, 7, 19, 73, 148, 60, 122, 129, 125, 68, 132, 65, 56, 137, 89, 44, 71, 128, 17, 72, 54, 149, 147, 24, 74, 37, 113, 80, 81, 34, 57, 87, 143, 52, 104, 88, 90, 4, 67, 3, 31, 62, 46, 40, 131, 47, 48, 75, 20, 32, 119, 6, 82, 10, 116, 0, 140, 123, 121, 117, 12, 108, 18, 5, 83, 53, 85, 93, 27, 107, 66, 106, 50, 35, 38, 105, 33, 51, 30, 39, 26, 21, 13, 120, 91, 133, 111, 8, 109, 100, 96, 59, 97, 136, 99, 29, 126, 25, 49, 124, 102, 16, 11, 76, 9, 43, 42, 64, 14, 94, 146, 130, 103, 127, 92, 135, 84, 101, 69, 28, 98, 86, 23, 138, 139, 36, 79, 1, 55, 144, 112, 45, 145, 95, 58, 114, 77, 22, 78, 61, 118 } ;
    int tab[N];
    memset(tab,0,sizeof tab);
    for (int i = 0; i < K; ++i)
    {
        tab[P[i]]=-1;
    }
    for (int i = 0; i < N; i+=2)
    {
        int cur=X%3;
        //cout <<arr[i]<<" "<<arr[i+1]<<endl;
        if(tab[arr[i]]==-1&&tab[arr[i+1]]==-1) continue;
        else if(tab[arr[i]]==-1&&(cur==0||cur==2)) continue;
        else if(tab[arr[i+1]]==-1&&(cur==1||cur==2)) continue;
        X/=3;
        if(cur==0) tab[arr[i]]=1;
        else if(cur==1) tab[arr[i+1]]=1;
        else tab[arr[i]]=tab[arr[i+1]]=1;
        if(X==0) break;
    }
    //cout <<X<<endl;
    for (int i = 0; i < N; ++i)
    {
        //cout <<tab[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> arr={ 141, 63, 142, 41, 134, 15, 110, 115, 2, 70, 7, 19, 73, 148, 60, 122, 129, 125, 68, 132, 65, 56, 137, 89, 44, 71, 128, 17, 72, 54, 149, 147, 24, 74, 37, 113, 80, 81, 34, 57, 87, 143, 52, 104, 88, 90, 4, 67, 3, 31, 62, 46, 40, 131, 47, 48, 75, 20, 32, 119, 6, 82, 10, 116, 0, 140, 123, 121, 117, 12, 108, 18, 5, 83, 53, 85, 93, 27, 107, 66, 106, 50, 35, 38, 105, 33, 51, 30, 39, 26, 21, 13, 120, 91, 133, 111, 8, 109, 100, 96, 59, 97, 136, 99, 29, 126, 25, 49, 124, 102, 16, 11, 76, 9, 43, 42, 64, 14, 94, 146, 130, 103, 127, 92, 135, 84, 101, 69, 28, 98, 86, 23, 138, 139, 36, 79, 1, 55, 144, 112, 45, 145, 95, 58, 114, 77, 22, 78, 61, 118 } ;
    vector<int> a;
    for (int i = 0; i < N; i+=2)
    {
        if(A[arr[i]]==1&&A[arr[i+1]]==1) a.push_back(2);
        else if(A[arr[i]]==1) a.push_back(0);
        else if(A[arr[i+1]]==1) a.push_back(1);
    }
    reverse(a.begin(),a.end());
    long long x=0;
    for(auto u:a){
        //cout <<u<<" "<<x<<endl;
        x=3*x+u;
    }
    //cout <<x<<endl;
    return x;
}
# Verdict Execution time Memory Grader output
1 Correct 24 ms 2400 KB Output is correct - L* = 40
2 Correct 20 ms 2428 KB Output is correct - L* = 40
3 Correct 20 ms 2396 KB Output is correct - L* = 40
4 Correct 22 ms 2408 KB Output is correct - L* = 40
5 Correct 20 ms 2400 KB Output is correct - L* = 40
6 Correct 22 ms 2392 KB Output is correct - L* = 40
7 Correct 22 ms 2396 KB Output is correct - L* = 40
8 Correct 22 ms 2424 KB Output is correct - L* = 40
9 Correct 22 ms 2396 KB Output is correct - L* = 40
10 Correct 24 ms 2404 KB Output is correct - L* = 40
11 Correct 22 ms 2396 KB Output is correct - L* = 40
12 Correct 20 ms 2500 KB Output is correct - L* = 40
13 Correct 22 ms 2448 KB Output is correct - L* = 40
14 Correct 20 ms 2392 KB Output is correct - L* = 40
15 Correct 22 ms 2396 KB Output is correct - L* = 40
16 Correct 22 ms 2444 KB Output is correct - L* = 40
17 Correct 20 ms 2552 KB Output is correct - L* = 40
18 Correct 22 ms 2384 KB Output is correct - L* = 40
19 Correct 25 ms 2736 KB Output is correct - L* = 40
20 Correct 20 ms 2392 KB Output is correct - L* = 40
21 Correct 25 ms 2592 KB Output is correct - L* = 40
22 Correct 22 ms 2404 KB Output is correct - L* = 40
23 Correct 20 ms 2396 KB Output is correct - L* = 40
24 Correct 22 ms 2496 KB Output is correct - L* = 40
25 Correct 22 ms 2392 KB Output is correct - L* = 40
26 Correct 22 ms 2604 KB Output is correct - L* = 40
27 Correct 20 ms 2396 KB Output is correct - L* = 40
28 Correct 20 ms 2456 KB Output is correct - L* = 40
29 Correct 20 ms 2396 KB Output is correct - L* = 40
30 Correct 26 ms 2464 KB Output is correct - L* = 40
31 Correct 22 ms 2396 KB Output is correct - L* = 40
32 Correct 24 ms 2488 KB Output is correct - L* = 40
33 Correct 22 ms 2464 KB Output is correct - L* = 40
34 Correct 24 ms 2396 KB Output is correct - L* = 40
35 Correct 22 ms 2672 KB Output is correct - L* = 40
36 Correct 20 ms 2600 KB Output is correct - L* = 40
37 Correct 23 ms 2396 KB Output is correct - L* = 40
38 Correct 22 ms 2372 KB Output is correct - L* = 40
39 Correct 23 ms 2368 KB Output is correct - L* = 40
40 Correct 23 ms 2408 KB Output is correct - L* = 40