Submission #902657

# Submission time Handle Problem Language Result Execution time Memory
902657 2024-01-10T22:55:25 Z nguyentunglam Broken Device (JOI17_broken_device) C++17
0 / 100
44 ms 2924 KB
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;

namespace {
  mt19937 rng(1);
}

void Anna( int n, long long x, int k, int p[] ){
  vector<bool> broken(n);
  vector<int> order(n);
  for(int i = 0; i < n; i++) order[i] = i;
  shuffle(order.begin(), order.end(), rng);
//  for(int i = 0; i < n; i++) cout << order[i] << " "; cout << endl;
  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[order[i]] || j < 0) {
      Set(order[i], 0);
      continue;
    }
    bool a = x >> j & 1;
    bool b = i - pre & 1;
    if (a == b) {
      pre = i;
      j--;
      Set(order[i], 1);
    }
    else Set(order[i], 0);
  }
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;

namespace {
mt19937 rng(1);

}

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

Compilation message

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

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:17:18: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   17 |     bool bit = i - pre & 1;
      |                ~~^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 2832 KB Program terminated incorrectly, or you printed something to stdout
2 Incorrect 37 ms 2820 KB Program terminated incorrectly, or you printed something to stdout
3 Incorrect 34 ms 2908 KB Program terminated incorrectly, or you printed something to stdout
4 Incorrect 30 ms 2696 KB Program terminated incorrectly, or you printed something to stdout
5 Incorrect 30 ms 2684 KB Program terminated incorrectly, or you printed something to stdout
6 Incorrect 38 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
7 Incorrect 34 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
8 Incorrect 39 ms 2748 KB Program terminated incorrectly, or you printed something to stdout
9 Incorrect 30 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
10 Incorrect 30 ms 2792 KB Program terminated incorrectly, or you printed something to stdout
11 Incorrect 39 ms 2676 KB Program terminated incorrectly, or you printed something to stdout
12 Incorrect 38 ms 2876 KB Program terminated incorrectly, or you printed something to stdout
13 Incorrect 34 ms 2848 KB Program terminated incorrectly, or you printed something to stdout
14 Incorrect 30 ms 2876 KB Program terminated incorrectly, or you printed something to stdout
15 Incorrect 30 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
16 Incorrect 43 ms 2840 KB Program terminated incorrectly, or you printed something to stdout
17 Incorrect 41 ms 2748 KB Program terminated incorrectly, or you printed something to stdout
18 Incorrect 42 ms 2788 KB Program terminated incorrectly, or you printed something to stdout
19 Incorrect 30 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
20 Incorrect 32 ms 2768 KB Program terminated incorrectly, or you printed something to stdout
21 Incorrect 30 ms 2768 KB Program terminated incorrectly, or you printed something to stdout
22 Incorrect 30 ms 2768 KB Program terminated incorrectly, or you printed something to stdout
23 Incorrect 30 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
24 Incorrect 28 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
25 Incorrect 32 ms 2816 KB Program terminated incorrectly, or you printed something to stdout
26 Incorrect 30 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
27 Incorrect 30 ms 2924 KB Program terminated incorrectly, or you printed something to stdout
28 Incorrect 31 ms 2900 KB Program terminated incorrectly, or you printed something to stdout
29 Incorrect 31 ms 2716 KB Program terminated incorrectly, or you printed something to stdout
30 Incorrect 33 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
31 Incorrect 39 ms 2748 KB Program terminated incorrectly, or you printed something to stdout
32 Incorrect 30 ms 2752 KB Program terminated incorrectly, or you printed something to stdout
33 Incorrect 30 ms 2876 KB Program terminated incorrectly, or you printed something to stdout
34 Incorrect 30 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
35 Incorrect 31 ms 2788 KB Program terminated incorrectly, or you printed something to stdout
36 Incorrect 30 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
37 Incorrect 39 ms 2752 KB Program terminated incorrectly, or you printed something to stdout
38 Incorrect 34 ms 2680 KB Program terminated incorrectly, or you printed something to stdout
39 Incorrect 44 ms 2684 KB Program terminated incorrectly, or you printed something to stdout
40 Incorrect 30 ms 2784 KB Program terminated incorrectly, or you printed something to stdout