답안 #775139

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
775139 2023-07-06T08:11:23 Z bachhoangxuan Broken Device (JOI17_broken_device) C++17
0 / 100
31 ms 2492 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;
    }
    cout << res << '\n';
    //cout << res << '\n';
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 2316 KB Program terminated incorrectly, or you printed something to stdout
2 Incorrect 30 ms 2412 KB Program terminated incorrectly, or you printed something to stdout
3 Incorrect 25 ms 2376 KB Program terminated incorrectly, or you printed something to stdout
4 Incorrect 24 ms 2492 KB Program terminated incorrectly, or you printed something to stdout
5 Incorrect 25 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
6 Incorrect 25 ms 2452 KB Program terminated incorrectly, or you printed something to stdout
7 Incorrect 24 ms 2376 KB Program terminated incorrectly, or you printed something to stdout
8 Incorrect 24 ms 2388 KB Program terminated incorrectly, or you printed something to stdout
9 Incorrect 24 ms 2296 KB Program terminated incorrectly, or you printed something to stdout
10 Incorrect 24 ms 2380 KB Program terminated incorrectly, or you printed something to stdout
11 Incorrect 26 ms 2376 KB Program terminated incorrectly, or you printed something to stdout
12 Incorrect 25 ms 2228 KB Program terminated incorrectly, or you printed something to stdout
13 Incorrect 25 ms 2268 KB Program terminated incorrectly, or you printed something to stdout
14 Incorrect 25 ms 2436 KB Program terminated incorrectly, or you printed something to stdout
15 Incorrect 24 ms 2368 KB Program terminated incorrectly, or you printed something to stdout
16 Incorrect 24 ms 2368 KB Program terminated incorrectly, or you printed something to stdout
17 Incorrect 28 ms 2408 KB Program terminated incorrectly, or you printed something to stdout
18 Incorrect 25 ms 2468 KB Program terminated incorrectly, or you printed something to stdout
19 Incorrect 25 ms 2460 KB Program terminated incorrectly, or you printed something to stdout
20 Incorrect 24 ms 2416 KB Program terminated incorrectly, or you printed something to stdout
21 Incorrect 24 ms 2428 KB Program terminated incorrectly, or you printed something to stdout
22 Incorrect 27 ms 2252 KB Program terminated incorrectly, or you printed something to stdout
23 Incorrect 27 ms 2360 KB Program terminated incorrectly, or you printed something to stdout
24 Incorrect 24 ms 2376 KB Program terminated incorrectly, or you printed something to stdout
25 Incorrect 27 ms 2376 KB Program terminated incorrectly, or you printed something to stdout
26 Incorrect 25 ms 2400 KB Program terminated incorrectly, or you printed something to stdout
27 Incorrect 24 ms 2376 KB Program terminated incorrectly, or you printed something to stdout
28 Incorrect 24 ms 2396 KB Program terminated incorrectly, or you printed something to stdout
29 Incorrect 24 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
30 Incorrect 24 ms 2392 KB Program terminated incorrectly, or you printed something to stdout
31 Incorrect 26 ms 2328 KB Program terminated incorrectly, or you printed something to stdout
32 Incorrect 27 ms 2356 KB Program terminated incorrectly, or you printed something to stdout
33 Incorrect 24 ms 2376 KB Program terminated incorrectly, or you printed something to stdout
34 Incorrect 24 ms 2368 KB Program terminated incorrectly, or you printed something to stdout
35 Incorrect 24 ms 2316 KB Program terminated incorrectly, or you printed something to stdout
36 Incorrect 25 ms 2356 KB Program terminated incorrectly, or you printed something to stdout
37 Incorrect 24 ms 2368 KB Program terminated incorrectly, or you printed something to stdout
38 Incorrect 24 ms 2368 KB Program terminated incorrectly, or you printed something to stdout
39 Incorrect 25 ms 2356 KB Program terminated incorrectly, or you printed something to stdout
40 Incorrect 26 ms 2360 KB Program terminated incorrectly, or you printed something to stdout