답안 #100041

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100041 2019-03-09T07:02:08 Z dantoh000 Broken Device (JOI17_broken_device) C++14
41 / 100
56 ms 3328 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
    bool isbroken[N]; memset(isbroken,0,sizeof(isbroken));
    for (int i = 0; i < K; i++){
        isbroken[P[i]] = true;
    }
    int s = 0, e = N-1;
    while (X && s < e){
        if (isbroken[s] && isbroken[e] || (X%2 == 1 && (isbroken[s]||isbroken[e]))){
            Set(s,0);
            Set(e,0);
        }
        else{
            //printf("%d",X%2);
            if (X % 2 == 1){
                Set(s,1);
                Set(e,1);
            }
            else{
                if (isbroken[s] || isbroken[e]){
                    Set(s,1);
                    Set(e,1);
                }
                else{
                    Set(s,1);
                    Set(e,0);
                }
            }
            X /= 2;
        }
        s++;
        e--;
    }
    for (int i = s; i <= e; i++){
        Set(i,0);
    }
    //printf("\n");
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
long long Bruno( int N, int A[] ){
    long long ans = 0ll;
    int s = 0, e = N-1;
    int num = 0;
    stack<bool> st;
    while (s<e && num <= 60){
        if (A[s] || A[e]){
            num++;
            //printf("%d",1-(A[s]^A[e]));
            st.push(1-(A[s]^A[e]));
        }
        s++;
        e--;
    }
    //printf("\n");
    while (st.size()){
        //printf("%d",st.top());
        ans*=2;
        ans+=st.top();
        st.pop();
    }
    //printf("\n%lld\n",ans);
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:11:25: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
         if (isbroken[s] && isbroken[e] || (X%2 == 1 && (isbroken[s]||isbroken[e]))){
             ~~~~~~~~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 40 ms 3056 KB Output is partially correct - L* = 16
2 Partially correct 37 ms 3072 KB Output is partially correct - L* = 16
3 Partially correct 39 ms 3328 KB Output is partially correct - L* = 15
4 Partially correct 40 ms 3072 KB Output is partially correct - L* = 16
5 Partially correct 37 ms 3072 KB Output is partially correct - L* = 16
6 Partially correct 39 ms 3056 KB Output is partially correct - L* = 17
7 Partially correct 49 ms 3056 KB Output is partially correct - L* = 15
8 Partially correct 52 ms 3072 KB Output is partially correct - L* = 16
9 Partially correct 45 ms 3056 KB Output is partially correct - L* = 16
10 Partially correct 49 ms 3072 KB Output is partially correct - L* = 16
11 Partially correct 40 ms 3056 KB Output is partially correct - L* = 17
12 Partially correct 38 ms 3016 KB Output is partially correct - L* = 15
13 Partially correct 37 ms 3056 KB Output is partially correct - L* = 16
14 Partially correct 40 ms 3072 KB Output is partially correct - L* = 16
15 Partially correct 41 ms 3072 KB Output is partially correct - L* = 16
16 Partially correct 39 ms 3056 KB Output is partially correct - L* = 16
17 Partially correct 41 ms 3056 KB Output is partially correct - L* = 15
18 Partially correct 36 ms 3072 KB Output is partially correct - L* = 16
19 Partially correct 55 ms 3056 KB Output is partially correct - L* = 17
20 Partially correct 44 ms 3072 KB Output is partially correct - L* = 15
21 Partially correct 38 ms 3072 KB Output is partially correct - L* = 16
22 Partially correct 52 ms 3056 KB Output is partially correct - L* = 18
23 Partially correct 40 ms 3056 KB Output is partially correct - L* = 15
24 Partially correct 39 ms 3064 KB Output is partially correct - L* = 16
25 Partially correct 37 ms 3072 KB Output is partially correct - L* = 16
26 Partially correct 39 ms 3056 KB Output is partially correct - L* = 15
27 Partially correct 40 ms 3072 KB Output is partially correct - L* = 15
28 Partially correct 47 ms 3016 KB Output is partially correct - L* = 16
29 Partially correct 43 ms 3056 KB Output is partially correct - L* = 15
30 Partially correct 53 ms 3056 KB Output is partially correct - L* = 16
31 Partially correct 44 ms 3056 KB Output is partially correct - L* = 16
32 Partially correct 39 ms 3072 KB Output is partially correct - L* = 15
33 Partially correct 56 ms 3056 KB Output is partially correct - L* = 16
34 Partially correct 52 ms 3056 KB Output is partially correct - L* = 16
35 Partially correct 45 ms 3072 KB Output is partially correct - L* = 15
36 Partially correct 38 ms 2976 KB Output is partially correct - L* = 15
37 Partially correct 36 ms 3056 KB Output is partially correct - L* = 17
38 Partially correct 40 ms 3072 KB Output is partially correct - L* = 16
39 Partially correct 34 ms 3072 KB Output is partially correct - L* = 15
40 Partially correct 34 ms 3072 KB Output is partially correct - L* = 15