답안 #852174

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
852174 2023-09-21T11:35:05 Z Rafi22 Broken Device (JOI17_broken_device) C++14
100 / 100
45 ms 2656 KB
    #include <bits/stdc++.h>
    #include "Annalib.h"

    #define ll long long
    #define ld long double
    #define endl '\n'
    #define st first
    #define nd second
    #define pb push_back
    #define sz(x) (int)(x).size()
    #define all(x) (x).begin(), (x).end()
    using namespace std;
    //int inf=1000000007;
    //int mod=1000000007;
    //int mod1=998244353;

    bool bad[157];
    int res[157];

    void Anna(int n,ll x,int k,int P[])
    {
        srand(2137);
        vector<int>ord;
        for(int i=0;i<150;i++) ord.pb(i);
        random_shuffle(all(ord));
        for(int i=0;i<150;i++)
        {
            res[i]=0;
            bad[i]=0;
        }
        for(int i=0;i<k;i++) bad[P[i]]=1;
        for(int i=0;i<150;i+=2)
        {
            if(bad[ord[i]]&&(x%3==0||x%3==2)) continue;
            if(bad[ord[i+1]]&&(x%3==1||x%3==2)) continue;
            if(x%3==0||x%3==2) res[ord[i]]=1;
            if(x%3==1||x%3==2) res[ord[i+1]]=1;
            x/=3;
        }
        for(int i=0;i<150;i++) Set(i,res[i]);
    }
#include <bits/stdc++.h>
#include "Brunolib.h"

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
//int inf=1000000007;
//int mod=1000000007;
//int mod1=998244353;

ll Bruno(int n,int a[])
{
    srand(2137);
    vector<int>ord;
    for(int i=0;i<150;i++) ord.pb(i);
    random_shuffle(all(ord));
    ll wyn=0,p=1;
    for(int i=0;i<150;i+=2)
    {
        if(a[ord[i]]==0&&a[ord[i+1]]==0) continue;
        if(a[ord[i]]==0&&a[ord[i+1]]==1) wyn+=p;
        if(a[ord[i]]==1&&a[ord[i+1]]==1) wyn+=2*p;
        p*=3;
    }
    return wyn;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 2400 KB Output is correct - L* = 40
2 Correct 33 ms 2408 KB Output is correct - L* = 40
3 Correct 32 ms 2564 KB Output is correct - L* = 40
4 Correct 33 ms 2584 KB Output is correct - L* = 40
5 Correct 31 ms 2400 KB Output is correct - L* = 40
6 Correct 36 ms 2304 KB Output is correct - L* = 40
7 Correct 31 ms 2304 KB Output is correct - L* = 40
8 Correct 45 ms 2304 KB Output is correct - L* = 40
9 Correct 32 ms 2584 KB Output is correct - L* = 40
10 Correct 33 ms 2308 KB Output is correct - L* = 40
11 Correct 41 ms 2544 KB Output is correct - L* = 40
12 Correct 31 ms 2392 KB Output is correct - L* = 40
13 Correct 31 ms 2304 KB Output is correct - L* = 40
14 Correct 33 ms 2392 KB Output is correct - L* = 40
15 Correct 31 ms 2392 KB Output is correct - L* = 40
16 Correct 32 ms 2332 KB Output is correct - L* = 40
17 Correct 31 ms 2392 KB Output is correct - L* = 40
18 Correct 31 ms 2308 KB Output is correct - L* = 40
19 Correct 31 ms 2400 KB Output is correct - L* = 40
20 Correct 31 ms 2332 KB Output is correct - L* = 40
21 Correct 35 ms 2308 KB Output is correct - L* = 40
22 Correct 32 ms 2648 KB Output is correct - L* = 40
23 Correct 31 ms 2304 KB Output is correct - L* = 40
24 Correct 31 ms 2656 KB Output is correct - L* = 40
25 Correct 39 ms 2400 KB Output is correct - L* = 40
26 Correct 31 ms 2312 KB Output is correct - L* = 40
27 Correct 33 ms 2492 KB Output is correct - L* = 40
28 Correct 33 ms 2308 KB Output is correct - L* = 40
29 Correct 31 ms 2432 KB Output is correct - L* = 40
30 Correct 31 ms 2372 KB Output is correct - L* = 40
31 Correct 32 ms 2424 KB Output is correct - L* = 40
32 Correct 31 ms 2400 KB Output is correct - L* = 40
33 Correct 31 ms 2392 KB Output is correct - L* = 40
34 Correct 37 ms 2304 KB Output is correct - L* = 40
35 Correct 38 ms 2456 KB Output is correct - L* = 40
36 Correct 31 ms 2392 KB Output is correct - L* = 40
37 Correct 32 ms 2404 KB Output is correct - L* = 40
38 Correct 33 ms 2308 KB Output is correct - L* = 40
39 Correct 35 ms 2512 KB Output is correct - L* = 40
40 Correct 33 ms 2304 KB Output is correct - L* = 40