답안 #294931

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
294931 2020-09-09T10:53:21 Z BThero Broken Device (JOI17_broken_device) C++17
41 / 100
65 ms 3352 KB
// chrono::system_clock::now().time_since_epoch().count()
#include "Annalib.h"
#include<bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " = " << x << endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

namespace {
  int n, k, bad_pos[45];
  int is_bad[150];
  ll msg;
  
  int bit(ll x, int p) {
    if (p > 60) return 0;
    return (x >> p) & 1;
  }
  
  void solve() {
    assert(n % 2 == 0);
    fill(is_bad, is_bad + n, 0);
  
    for (int i = 0; i < k; ++i) {
      is_bad[bad_pos[i]] = 1;
    }
    
    int ptr = 0;
  
    for (int i = 0; i < n; i += 2) {
      if (is_bad[i] || is_bad[i + 1]) {
        Set(i, 0);
        Set(i + 1, 0);
      }
      else {
        Set(i, 1);
        Set(i + 1, bit(msg, ptr++));
      }
    }
  }
};

void Anna( int N, long long X, int K, int P[] ){
  n = N;
  msg = X;
  k = K;
  
  for (int i = 0; i < k; ++i) {
    bad_pos[i] = P[i];
  }

  solve();
}
// chrono::system_clock::now().time_since_epoch().count()
#include "Brunolib.h"
#include<bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " = " << x << endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

namespace {
  int n, arr[150];
  
  ll solve() {
    assert(n % 2 == 0);
    ll ret = 0;
    int ptr = 0;
  
    for (int i = 0; i < n; i += 2) {
      if (arr[i] == 0) {
        continue;
      }
      
      if (arr[i + 1] == 1) {
        ret += (1ll << ptr);
      }
      
      ptr++;
    }
    
    return ret;
  }
};

long long Bruno( int N, int A[] ){
  n = N;
  
  for (int i = 0; i < n; ++i) {
    arr[i] = A[i];
  }

  return solve();
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 47 ms 3312 KB Output is partially correct - L* = 15
2 Partially correct 47 ms 3312 KB Output is partially correct - L* = 15
3 Partially correct 49 ms 3328 KB Output is partially correct - L* = 16
4 Partially correct 47 ms 3328 KB Output is partially correct - L* = 15
5 Partially correct 48 ms 3312 KB Output is partially correct - L* = 15
6 Partially correct 45 ms 3328 KB Output is partially correct - L* = 15
7 Partially correct 47 ms 3328 KB Output is partially correct - L* = 15
8 Partially correct 46 ms 3328 KB Output is partially correct - L* = 15
9 Partially correct 46 ms 3312 KB Output is partially correct - L* = 16
10 Partially correct 44 ms 3328 KB Output is partially correct - L* = 16
11 Partially correct 47 ms 3328 KB Output is partially correct - L* = 15
12 Partially correct 48 ms 3328 KB Output is partially correct - L* = 16
13 Partially correct 46 ms 3312 KB Output is partially correct - L* = 15
14 Partially correct 45 ms 3312 KB Output is partially correct - L* = 15
15 Partially correct 47 ms 3320 KB Output is partially correct - L* = 15
16 Partially correct 46 ms 3312 KB Output is partially correct - L* = 15
17 Partially correct 45 ms 3328 KB Output is partially correct - L* = 15
18 Partially correct 45 ms 3328 KB Output is partially correct - L* = 15
19 Partially correct 45 ms 3312 KB Output is partially correct - L* = 16
20 Partially correct 65 ms 3328 KB Output is partially correct - L* = 15
21 Partially correct 45 ms 3312 KB Output is partially correct - L* = 15
22 Partially correct 48 ms 3312 KB Output is partially correct - L* = 15
23 Partially correct 47 ms 3328 KB Output is partially correct - L* = 15
24 Partially correct 46 ms 3320 KB Output is partially correct - L* = 15
25 Partially correct 46 ms 3328 KB Output is partially correct - L* = 15
26 Partially correct 46 ms 3312 KB Output is partially correct - L* = 15
27 Partially correct 46 ms 3328 KB Output is partially correct - L* = 15
28 Partially correct 45 ms 3312 KB Output is partially correct - L* = 15
29 Partially correct 46 ms 3192 KB Output is partially correct - L* = 15
30 Partially correct 56 ms 3352 KB Output is partially correct - L* = 15
31 Partially correct 46 ms 3336 KB Output is partially correct - L* = 15
32 Partially correct 47 ms 3312 KB Output is partially correct - L* = 16
33 Partially correct 45 ms 3320 KB Output is partially correct - L* = 15
34 Partially correct 46 ms 3312 KB Output is partially correct - L* = 15
35 Partially correct 45 ms 3328 KB Output is partially correct - L* = 15
36 Partially correct 46 ms 3312 KB Output is partially correct - L* = 15
37 Partially correct 46 ms 3152 KB Output is partially correct - L* = 16
38 Partially correct 46 ms 3328 KB Output is partially correct - L* = 15
39 Partially correct 46 ms 3296 KB Output is partially correct - L* = 15
40 Partially correct 50 ms 3328 KB Output is partially correct - L* = 15