Submission #902652

# Submission time Handle Problem Language Result Execution time Memory
902652 2024-01-10T22:43:23 Z nguyentunglam Broken Device (JOI17_broken_device) C++17
61 / 100
40 ms 2656 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;
    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;
    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:16: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   16 |     bool b = i - pre & 1;
      |              ~~^~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:8:18: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
    8 |     bool bit = i - pre & 1;
      |                ~~^~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 28 ms 2460 KB Output is partially correct - L* = 31
2 Partially correct 25 ms 2400 KB Output is partially correct - L* = 28
3 Partially correct 26 ms 2396 KB Output is partially correct - L* = 30
4 Partially correct 32 ms 2360 KB Output is partially correct - L* = 32
5 Partially correct 33 ms 2368 KB Output is partially correct - L* = 31
6 Partially correct 27 ms 2396 KB Output is partially correct - L* = 28
7 Partially correct 25 ms 2420 KB Output is partially correct - L* = 29
8 Partially correct 28 ms 2388 KB Output is partially correct - L* = 29
9 Partially correct 30 ms 2656 KB Output is partially correct - L* = 30
10 Partially correct 38 ms 2488 KB Output is partially correct - L* = 30
11 Partially correct 38 ms 2396 KB Output is partially correct - L* = 33
12 Partially correct 25 ms 2372 KB Output is partially correct - L* = 33
13 Partially correct 30 ms 2408 KB Output is partially correct - L* = 31
14 Partially correct 26 ms 2420 KB Output is partially correct - L* = 25
15 Partially correct 40 ms 2392 KB Output is partially correct - L* = 36
16 Partially correct 25 ms 2372 KB Output is partially correct - L* = 33
17 Partially correct 31 ms 2412 KB Output is partially correct - L* = 29
18 Partially correct 25 ms 2396 KB Output is partially correct - L* = 32
19 Partially correct 25 ms 2504 KB Output is partially correct - L* = 27
20 Partially correct 25 ms 2632 KB Output is partially correct - L* = 29
21 Partially correct 27 ms 2500 KB Output is partially correct - L* = 30
22 Partially correct 35 ms 2568 KB Output is partially correct - L* = 30
23 Partially correct 26 ms 2480 KB Output is partially correct - L* = 31
24 Partially correct 25 ms 2396 KB Output is partially correct - L* = 32
25 Partially correct 25 ms 2476 KB Output is partially correct - L* = 29
26 Partially correct 25 ms 2396 KB Output is partially correct - L* = 31
27 Partially correct 25 ms 2396 KB Output is partially correct - L* = 26
28 Partially correct 28 ms 2400 KB Output is partially correct - L* = 30
29 Partially correct 28 ms 2376 KB Output is partially correct - L* = 33
30 Partially correct 28 ms 2436 KB Output is partially correct - L* = 32
31 Partially correct 25 ms 2372 KB Output is partially correct - L* = 26
32 Partially correct 25 ms 2404 KB Output is partially correct - L* = 30
33 Partially correct 25 ms 2372 KB Output is partially correct - L* = 35
34 Partially correct 33 ms 2396 KB Output is partially correct - L* = 35
35 Partially correct 27 ms 2364 KB Output is partially correct - L* = 28
36 Partially correct 25 ms 2488 KB Output is partially correct - L* = 27
37 Partially correct 26 ms 2400 KB Output is partially correct - L* = 29
38 Partially correct 26 ms 2396 KB Output is partially correct - L* = 29
39 Partially correct 25 ms 2600 KB Output is partially correct - L* = 35
40 Partially correct 33 ms 2592 KB Output is partially correct - L* = 30