답안 #902651

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

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

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

//struct decode {
  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;
      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;
  }
//};
//decode solve;

//long long Bruno( int n, int a[] ){
//  return solve.Bruno(n, a);
//}

Compilation message

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

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:9:20: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
    9 |       bool bit = i - pre & 1;
      |                  ~~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 94 ms 3520 KB Execution killed with signal 11
2 Runtime error 91 ms 3712 KB Execution killed with signal 11
3 Runtime error 91 ms 3668 KB Execution killed with signal 11
4 Runtime error 91 ms 3708 KB Execution killed with signal 11
5 Runtime error 95 ms 3628 KB Execution killed with signal 11
6 Runtime error 110 ms 3648 KB Execution killed with signal 11
7 Runtime error 94 ms 3632 KB Execution killed with signal 11
8 Runtime error 95 ms 3552 KB Execution killed with signal 11
9 Runtime error 109 ms 3724 KB Execution killed with signal 11
10 Runtime error 96 ms 3732 KB Execution killed with signal 11
11 Runtime error 91 ms 3684 KB Execution killed with signal 11
12 Runtime error 108 ms 3680 KB Execution killed with signal 11
13 Runtime error 91 ms 3684 KB Execution killed with signal 11
14 Runtime error 92 ms 3640 KB Execution killed with signal 11
15 Runtime error 114 ms 3680 KB Execution killed with signal 11
16 Runtime error 125 ms 3660 KB Execution killed with signal 11
17 Runtime error 111 ms 3676 KB Execution killed with signal 11
18 Runtime error 96 ms 3680 KB Execution killed with signal 11
19 Runtime error 109 ms 3688 KB Execution killed with signal 11
20 Runtime error 93 ms 3712 KB Execution killed with signal 11
21 Runtime error 102 ms 3668 KB Execution killed with signal 11
22 Runtime error 97 ms 3592 KB Execution killed with signal 11
23 Runtime error 95 ms 3760 KB Execution killed with signal 11
24 Runtime error 93 ms 3696 KB Execution killed with signal 11
25 Runtime error 108 ms 3664 KB Execution killed with signal 11
26 Runtime error 111 ms 3552 KB Execution killed with signal 11
27 Runtime error 116 ms 3680 KB Execution killed with signal 11
28 Runtime error 91 ms 3640 KB Execution killed with signal 11
29 Runtime error 101 ms 3624 KB Execution killed with signal 11
30 Runtime error 91 ms 3684 KB Execution killed with signal 11
31 Runtime error 114 ms 3660 KB Execution killed with signal 11
32 Runtime error 91 ms 3684 KB Execution killed with signal 11
33 Runtime error 98 ms 3556 KB Execution killed with signal 11
34 Runtime error 97 ms 3680 KB Execution killed with signal 11
35 Runtime error 117 ms 3672 KB Execution killed with signal 11
36 Runtime error 104 ms 3708 KB Execution killed with signal 11
37 Runtime error 93 ms 3664 KB Execution killed with signal 11
38 Runtime error 117 ms 3528 KB Execution killed with signal 11
39 Runtime error 91 ms 3692 KB Execution killed with signal 11
40 Runtime error 101 ms 3848 KB Execution killed with signal 11