답안 #959197

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
959197 2024-04-07T16:05:34 Z De3b0o Broken Device (JOI17_broken_device) C++14
100 / 100
43 ms 3024 KB
#include "Annalib.h"
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)

using namespace std;

void Anna(int N, long long X, int K, int P[])
{
    ll p = 0;
    ll b = 1;
    map<ll,bool> mp;
    for(int i = 0 ; K>i ; i++)
        mp[P[i]]=1;
    for(int i = 0 ; 150>i ; i+=3)
    {
        ll c=mp[i]+mp[i+1]+mp[i+2];
        if(c>=2)
        {
            Set(i,0);
            Set(i+1,0);
            Set(i+2,0);
            continue;
        }
        if(c==0)
        {
            if((b&X)&&((b*2)&X))
            {
                Set(i,1);
                Set(i+1,0);
                Set(i+2,0);
            }
            else if(b&X)
            {
                Set(i,1);
                Set(i+1,0);
                Set(i+2,1);
            }
            else if((b*2)&X)
            {
                Set(i,0);
                Set(i+1,1);
                Set(i+2,1);
            }
            else
            {
                Set(i,1);
                Set(i+1,1);
                Set(i+2,1);
            }
            b*=4;
        }
        else if(c==1)
        {
            if(b&X)
            {
                if(mp[i+1])
                {
                    b*=2;
                    if(b&X)
                    {
                        Set(i,1);
                        Set(i+1,0);
                        Set(i+2,0);
                    }
                    else
                    {
                        Set(i,1);
                        Set(i+1,0);
                        Set(i+2,1);
                    }
                }
                else
                {
                    Set(i,0);
                    Set(i+1,1);
                    Set(i+2,0);
                }
            }
            else
            {
                if(mp[i+2])
                {
                    Set(i,1);
                    Set(i+1,1);
                    Set(i+2,0);
                }
                else
                {
                    Set(i,0);
                    Set(i+1,0);
                    Set(i+2,1);
                }
            }
            b*=2;
        }
    }
}
#include "Brunolib.h"
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)

using namespace std;

long long Bruno( int N, int A[] )
{
    ll b = 1;
    ll ans = 0;
    for(int i = 0 ; 150>i ; i+=3)
    {
        ll c = 4*A[i]+2*A[i+1]+A[i+2];
        if(c==0)
            continue;
        if(c==1)
            b*=2;
        else if(c==2)
        {
            ans+=b;
            b*=2;
        }
        else if(c==3)
        {
            b*=2;
            ans+=b;
            b*=2;
        }
        else if(c==4)
        {
            ans+=b;
            b*=2;
            ans+=b;
            b*=2;
        }
        else if(c==5)
        {
            ans+=b;
            b*=4;
        }
        else if(c==6)
            b*=2;
        else if(c==7)
            b*=4;
    }
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:25:8: warning: unused variable 'p' [-Wunused-variable]
   25 |     ll p = 0;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 2760 KB Output is correct - L* = 40
2 Correct 36 ms 2680 KB Output is correct - L* = 40
3 Correct 36 ms 2744 KB Output is correct - L* = 40
4 Correct 43 ms 2824 KB Output is correct - L* = 40
5 Correct 36 ms 2752 KB Output is correct - L* = 40
6 Correct 35 ms 2784 KB Output is correct - L* = 40
7 Correct 38 ms 2680 KB Output is correct - L* = 40
8 Correct 36 ms 2784 KB Output is correct - L* = 40
9 Correct 35 ms 2716 KB Output is correct - L* = 40
10 Correct 36 ms 2752 KB Output is correct - L* = 40
11 Correct 35 ms 2800 KB Output is correct - L* = 40
12 Correct 39 ms 2692 KB Output is correct - L* = 40
13 Correct 41 ms 2724 KB Output is correct - L* = 40
14 Correct 36 ms 2748 KB Output is correct - L* = 40
15 Correct 41 ms 3008 KB Output is correct - L* = 40
16 Correct 35 ms 2744 KB Output is correct - L* = 40
17 Correct 36 ms 2784 KB Output is correct - L* = 40
18 Correct 38 ms 2740 KB Output is correct - L* = 40
19 Correct 36 ms 2752 KB Output is correct - L* = 40
20 Correct 39 ms 2776 KB Output is correct - L* = 40
21 Correct 43 ms 2772 KB Output is correct - L* = 40
22 Correct 36 ms 2740 KB Output is correct - L* = 40
23 Correct 38 ms 2844 KB Output is correct - L* = 40
24 Correct 36 ms 2664 KB Output is correct - L* = 40
25 Correct 38 ms 2752 KB Output is correct - L* = 40
26 Correct 37 ms 2848 KB Output is correct - L* = 40
27 Correct 36 ms 2780 KB Output is correct - L* = 40
28 Correct 36 ms 2740 KB Output is correct - L* = 40
29 Correct 36 ms 2700 KB Output is correct - L* = 40
30 Correct 40 ms 2776 KB Output is correct - L* = 40
31 Correct 36 ms 2772 KB Output is correct - L* = 40
32 Correct 37 ms 2936 KB Output is correct - L* = 40
33 Correct 35 ms 2752 KB Output is correct - L* = 40
34 Correct 43 ms 2660 KB Output is correct - L* = 40
35 Correct 36 ms 2768 KB Output is correct - L* = 40
36 Correct 37 ms 2936 KB Output is correct - L* = 40
37 Correct 37 ms 2744 KB Output is correct - L* = 40
38 Correct 38 ms 3024 KB Output is correct - L* = 40
39 Correct 36 ms 2672 KB Output is correct - L* = 40
40 Correct 36 ms 2676 KB Output is correct - L* = 40