답안 #902640

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
902640 2024-01-10T22:05:18 Z nguyentunglam Broken Device (JOI17_broken_device) C++17
43 / 100
42 ms 2872 KB
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;

void Anna( int n, long long x, int k, int p[] ){
  vector<bool> broken(n);
  for(int i = 0; i < n; i++) broken[i] = 0;
  for(int i = 0; i < k; i++) broken[p[i]] = 1;

  for(int i = 0, pre = -1, j = 59; i < n; i++) {
    if (broken[i] || j < 0) {
      Set(i, 0);
      continue;
    }
    bool a = x >> j & 1;
    bool b = i - pre - 1 & 1;
    if (a == b) {
      pre = i;
      j--;
      Set(i, 1);
    }
    else Set(i, 0);
  }
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;

long long Bruno( int n, int a[] ){
  long long x = 0;
  for(int i = 0, pre = -1, j = 59; i < n && j >= 0; i++) if (a[i]) {
    bool bit = i - pre - 1 & 1;
    if (bit) x |= (1LL << j);
    j--;
    pre = i;
  }
//  for(int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
//  cout << "answer :" << x << endl;
  return x;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:16:22: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   16 |     bool b = i - pre - 1 & 1;
      |              ~~~~~~~~^~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:8:24: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
    8 |     bool bit = i - pre - 1 & 1;
      |                ~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 36 ms 2832 KB Output is partially correct - L* = 29
2 Partially correct 25 ms 2776 KB Output is partially correct - L* = 17
3 Partially correct 25 ms 2632 KB Output is partially correct - L* = 28
4 Partially correct 41 ms 2752 KB Output is partially correct - L* = 18
5 Partially correct 31 ms 2824 KB Output is partially correct - L* = 20
6 Partially correct 36 ms 2684 KB Output is partially correct - L* = 17
7 Partially correct 25 ms 2776 KB Output is partially correct - L* = 23
8 Partially correct 25 ms 2864 KB Output is partially correct - L* = 30
9 Partially correct 25 ms 2864 KB Output is partially correct - L* = 25
10 Partially correct 26 ms 2860 KB Output is partially correct - L* = 28
11 Partially correct 25 ms 2856 KB Output is partially correct - L* = 31
12 Partially correct 34 ms 2776 KB Output is partially correct - L* = 28
13 Partially correct 37 ms 2748 KB Output is partially correct - L* = 28
14 Partially correct 26 ms 2684 KB Output is partially correct - L* = 19
15 Partially correct 33 ms 2752 KB Output is partially correct - L* = 32
16 Partially correct 25 ms 2864 KB Output is partially correct - L* = 18
17 Partially correct 25 ms 2752 KB Output is partially correct - L* = 17
18 Partially correct 25 ms 2796 KB Output is partially correct - L* = 16
19 Partially correct 25 ms 2772 KB Output is partially correct - L* = 19
20 Partially correct 25 ms 2864 KB Output is partially correct - L* = 27
21 Partially correct 25 ms 2780 KB Output is partially correct - L* = 29
22 Partially correct 28 ms 2852 KB Output is partially correct - L* = 25
23 Partially correct 25 ms 2812 KB Output is partially correct - L* = 26
24 Partially correct 25 ms 2784 KB Output is partially correct - L* = 22
25 Partially correct 26 ms 2872 KB Output is partially correct - L* = 16
26 Partially correct 26 ms 2696 KB Output is partially correct - L* = 23
27 Partially correct 42 ms 2680 KB Output is partially correct - L* = 16
28 Partially correct 25 ms 2636 KB Output is partially correct - L* = 30
29 Partially correct 25 ms 2772 KB Output is partially correct - L* = 25
30 Partially correct 27 ms 2764 KB Output is partially correct - L* = 26
31 Partially correct 32 ms 2768 KB Output is partially correct - L* = 32
32 Partially correct 35 ms 2768 KB Output is partially correct - L* = 27
33 Partially correct 34 ms 2752 KB Output is partially correct - L* = 30
34 Partially correct 25 ms 2840 KB Output is partially correct - L* = 26
35 Partially correct 30 ms 2844 KB Output is partially correct - L* = 26
36 Partially correct 35 ms 2776 KB Output is partially correct - L* = 20
37 Partially correct 26 ms 2712 KB Output is partially correct - L* = 16
38 Partially correct 28 ms 2840 KB Output is partially correct - L* = 25
39 Partially correct 25 ms 2768 KB Output is partially correct - L* = 26
40 Partially correct 26 ms 2800 KB Output is partially correct - L* = 25