답안 #775141

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
775141 2023-07-06T08:12:18 Z bachhoangxuan Broken Device (JOI17_broken_device) C++17
100 / 100
36 ms 2368 KB
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;

void Anna( int N, long long X, int K, int P[] ){
    //cout << '*' << N << ' ' << X << ' ' << K << '\n';
    vector<int> d(N,0);
    for(int i=0;i<K;i++) d[P[i]]=1;
    for(int i=N-3;i>=0;i-=3){
        int a=0,b=0,c=0;
        if(d[i]+d[i+1]+d[i+2]==0){
            if(X%4==0) b=1;
            else a=1,b=X>>1&1,c=X&1;
            X/=4;
        }
        else if(d[i]+d[i+1]+d[i+2]==1){
            if(X&1){
                if(d[i]) b=c=1;
                else a=1;
            }
            else if(d[i+2]) a=X>>1&1,b=1,X/=2;
            else c=1;
            X/=2;
        }
        Set(i,a);Set(i+1,b);Set(i+2,c);
        //cout << X << ' ' << a << b << c << '\n';
    }
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;

long long Bruno( int N, int A[] ){
    long long res=0;
    for(int i=0;i<N;i+=3){
        int num=A[i]*4+A[i+1]*2+A[i+2];
        if(num==1) res*=2;
        else if(num==2) res*=4;
        else if(num>=5) res=res*4+num%4;
        else if(num>=3) res=res*2+1;
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 2296 KB Output is correct - L* = 40
2 Correct 24 ms 2248 KB Output is correct - L* = 40
3 Correct 26 ms 2304 KB Output is correct - L* = 40
4 Correct 25 ms 2348 KB Output is correct - L* = 40
5 Correct 26 ms 2252 KB Output is correct - L* = 40
6 Correct 24 ms 2356 KB Output is correct - L* = 40
7 Correct 27 ms 2236 KB Output is correct - L* = 40
8 Correct 25 ms 2248 KB Output is correct - L* = 40
9 Correct 24 ms 2324 KB Output is correct - L* = 40
10 Correct 24 ms 2368 KB Output is correct - L* = 40
11 Correct 24 ms 2248 KB Output is correct - L* = 40
12 Correct 25 ms 2256 KB Output is correct - L* = 40
13 Correct 25 ms 2364 KB Output is correct - L* = 40
14 Correct 26 ms 2296 KB Output is correct - L* = 40
15 Correct 26 ms 2340 KB Output is correct - L* = 40
16 Correct 25 ms 2316 KB Output is correct - L* = 40
17 Correct 25 ms 2248 KB Output is correct - L* = 40
18 Correct 24 ms 2288 KB Output is correct - L* = 40
19 Correct 30 ms 2308 KB Output is correct - L* = 40
20 Correct 33 ms 2256 KB Output is correct - L* = 40
21 Correct 24 ms 2248 KB Output is correct - L* = 40
22 Correct 24 ms 2332 KB Output is correct - L* = 40
23 Correct 24 ms 2248 KB Output is correct - L* = 40
24 Correct 30 ms 2336 KB Output is correct - L* = 40
25 Correct 33 ms 2264 KB Output is correct - L* = 40
26 Correct 33 ms 2332 KB Output is correct - L* = 40
27 Correct 25 ms 2324 KB Output is correct - L* = 40
28 Correct 25 ms 2248 KB Output is correct - L* = 40
29 Correct 27 ms 2276 KB Output is correct - L* = 40
30 Correct 30 ms 2316 KB Output is correct - L* = 40
31 Correct 26 ms 2324 KB Output is correct - L* = 40
32 Correct 30 ms 2312 KB Output is correct - L* = 40
33 Correct 24 ms 2340 KB Output is correct - L* = 40
34 Correct 36 ms 2288 KB Output is correct - L* = 40
35 Correct 25 ms 2288 KB Output is correct - L* = 40
36 Correct 25 ms 2332 KB Output is correct - L* = 40
37 Correct 24 ms 2280 KB Output is correct - L* = 40
38 Correct 23 ms 2308 KB Output is correct - L* = 40
39 Correct 27 ms 2224 KB Output is correct - L* = 40
40 Correct 33 ms 2272 KB Output is correct - L* = 40