답안 #100078

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100078 2019-03-09T08:14:52 Z dwsc Broken Device (JOI17_broken_device) C++14
51 / 100
69 ms 3120 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
    int broke[N] = {0};
    for (int i = 0; i < K; i++) broke[P[i]] = 1;
    long long pow = 1;
    for (int i = 0; i < 59; i++) pow*= 2;
    //cout << pow;
    for (int i = 0; i < N; i+= 3){
        int countbroke = 0;
        for (int j = i; j < i+3; j++){
            countbroke += broke[j];
        }
        //cout << i << " " << countbroke << " " << pow<< "\n";
        if (pow == 0) countbroke = 3;
        if (countbroke >= 1){
            for (int j = i; j < i+3; j++) Set(j,0);
        }
       /* else if (countbroke == 1){
            int before = 0;
            if (X >= pow){
                X -= pow;
                before = 1;
            }
            pow /= 2;
            if (broke[i]){
                Set(i,0);
                Set(i+1,before);
                Set(i+2,!before);
            }
            if (broke[i+1]){
                Set(i,before);
                Set(i+1,0);
                Set(i+2,!before);
            }
            if (broke[i+2]){
                Set(i,before);
                Set(i+1,!before);
                Set(i+2,0);
            }
        }*/
        else{
            //cout << "hi\n";
            int num1 = 0,num2 = 0;
            if (X >= pow){
                X -= pow;
                num1 = 1;
            }
            pow /= 2;
            if (X >= pow){
                X -= pow;
                num2 = 1;
            }
            pow /= 2;
            //cout << num1 << " " << num2 << "\n";
            if (num1 && num2){
                Set(i,1);
                Set(i+1,1);
                Set(i+2,1);
            }
            else if (num1){
                Set(i,1);
                Set(i+1,1);
                Set(i+2,0);
            }
            else if (num2){
                Set(i,1);
                Set(i+1,0);
                Set(i+2,1);
            }
            else{
                Set(i,0);
                Set(i+1,1);
                Set(i+2,1);
            }
        }
    }
}
#include "Brunolib.h"

long long Bruno( int N, int A[] ){
    long long pow = 1;
    for (int i = 0; i < 59; i++) pow*= 2;
    long long ans = 0;
    for (int i = 0; i < N; i+= 3){
        int temp = A[i]+A[i+1]+A[i+2];
        if (temp == 0) continue;
        if (A[i] && A[i+1] && A[i+2]){
            ans += pow;
            pow/=2;
            ans += pow;
            pow/=2;
        }
        else if (A[i] && A[i+1]){
            ans += pow;
            pow/=4;
        }
        else if (A[i] && A[i+2]){
            pow/=2;
            ans += pow;
            pow/=2;
        }
        else{
            pow/=4;
        }
      //  cout << ans << "\n";
    }
   // cout << "hi\n";
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 46 ms 3056 KB Output is partially correct - L* = 20
2 Partially correct 63 ms 3056 KB Output is partially correct - L* = 20
3 Partially correct 41 ms 2872 KB Output is partially correct - L* = 20
4 Partially correct 41 ms 3072 KB Output is partially correct - L* = 21
5 Partially correct 47 ms 3056 KB Output is partially correct - L* = 20
6 Partially correct 44 ms 3056 KB Output is partially correct - L* = 20
7 Partially correct 46 ms 3072 KB Output is partially correct - L* = 20
8 Partially correct 35 ms 3072 KB Output is partially correct - L* = 20
9 Partially correct 48 ms 3000 KB Output is partially correct - L* = 20
10 Partially correct 41 ms 2944 KB Output is partially correct - L* = 20
11 Partially correct 35 ms 3072 KB Output is partially correct - L* = 20
12 Partially correct 36 ms 3056 KB Output is partially correct - L* = 20
13 Partially correct 57 ms 3056 KB Output is partially correct - L* = 21
14 Partially correct 48 ms 3056 KB Output is partially correct - L* = 20
15 Partially correct 35 ms 3072 KB Output is partially correct - L* = 20
16 Partially correct 44 ms 3072 KB Output is partially correct - L* = 21
17 Partially correct 37 ms 2912 KB Output is partially correct - L* = 20
18 Partially correct 61 ms 3072 KB Output is partially correct - L* = 20
19 Partially correct 45 ms 3056 KB Output is partially correct - L* = 20
20 Partially correct 45 ms 3056 KB Output is partially correct - L* = 20
21 Partially correct 69 ms 2848 KB Output is partially correct - L* = 20
22 Partially correct 40 ms 3056 KB Output is partially correct - L* = 20
23 Partially correct 65 ms 3056 KB Output is partially correct - L* = 20
24 Partially correct 45 ms 3072 KB Output is partially correct - L* = 21
25 Partially correct 46 ms 3072 KB Output is partially correct - L* = 20
26 Partially correct 50 ms 3056 KB Output is partially correct - L* = 20
27 Partially correct 46 ms 3056 KB Output is partially correct - L* = 20
28 Partially correct 52 ms 3120 KB Output is partially correct - L* = 20
29 Partially correct 56 ms 3064 KB Output is partially correct - L* = 20
30 Partially correct 46 ms 3032 KB Output is partially correct - L* = 21
31 Partially correct 51 ms 2840 KB Output is partially correct - L* = 20
32 Partially correct 61 ms 3056 KB Output is partially correct - L* = 20
33 Partially correct 41 ms 3056 KB Output is partially correct - L* = 20
34 Partially correct 44 ms 3072 KB Output is partially correct - L* = 20
35 Partially correct 57 ms 3056 KB Output is partially correct - L* = 20
36 Partially correct 50 ms 3056 KB Output is partially correct - L* = 20
37 Partially correct 61 ms 2944 KB Output is partially correct - L* = 20
38 Partially correct 39 ms 3072 KB Output is partially correct - L* = 20
39 Partially correct 49 ms 3072 KB Output is partially correct - L* = 20
40 Partially correct 37 ms 3000 KB Output is partially correct - L* = 20