Submission #990973

# Submission time Handle Problem Language Result Execution time Memory
990973 2024-06-01T02:03:24 Z abczz Broken Device (JOI17_broken_device) C++14
0 / 100
39 ms 2956 KB
#include "Annalib.h"
#include <iostream>
#include <random>
#include <vector>
#include <algorithm>
#define ll long long

using namespace std;

void Anna( int N, long long X, int K, int P[] ){
  mt19937_64 mt(69);
  ll perm[150];
  for (int i=0; i<N; ++i) {
    perm[i] = i;
  }
  shuffle(perm, perm+N, mt);
  ll x = 805215019090496300;
  bool B[150], F[150];
  for (int i=0; i<N; ++i) B[i] = F[i] = 0;
  for (int i=0; i<K; ++i) B[P[i]] = 1;
  x ^= X;
  ll p = 0;
  for (int i=59; i>=0; --i) {
    ll bit = (bool)(x & (1LL<<i));
    //cout << bit;
    for (; p+1<N; ++p) {
      if (!B[perm[p]] && (!bit || !B[perm[p+1]])) {
        F[perm[p]] = 1;
        F[perm[p+1]] = bit;
        p += 2;
        break;
      }
    }
  }
  //cout << endl;
  for (int i=0; i<N; ++i) {
    //cout << F[perm[i]];
    Set(i, F[i]);
  }
  //cout << endl;
}
#include "Brunolib.h"
#include <iostream>
#include <vector>
#include <random>
#include <algorithm>
#define ll long long

using namespace std;

long long Bruno( int N, int A[] ){
  mt19937_64 mt(69);
  vector <ll> V;
  ll perm[150], par[150];
  for (int i=0; i<N; ++i) {
    perm[i] = i;
  }
  shuffle(perm, perm+N, mt);
  for (int i=0; i<N; ++i) {
    par[perm[i]] = i;
  }
  //for (int i=0; i<N; ++i) cout << A[perm[i]];
  //cout << endl;
  ll x = 805215019090496300, p = 0;
  int i=59;
  for (; p+1<N; ++p) {
    if (A[perm[p]]) {
      //cout << A[perm[p+1]];
      if (A[perm[p+1]]) x ^= (1LL<<i);
      ++p;
      --i;
    }
  }
  //cout << endl;
  cout << x << endl;
  return x;
}

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:13:17: warning: variable 'par' set but not used [-Wunused-but-set-variable]
   13 |   ll perm[150], par[150];
      |                 ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2752 KB Program terminated incorrectly, or you printed something to stdout
2 Incorrect 26 ms 2748 KB Program terminated incorrectly, or you printed something to stdout
3 Incorrect 26 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
4 Incorrect 26 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
5 Incorrect 27 ms 2840 KB Program terminated incorrectly, or you printed something to stdout
6 Incorrect 25 ms 2884 KB Program terminated incorrectly, or you printed something to stdout
7 Incorrect 26 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
8 Incorrect 26 ms 2824 KB Program terminated incorrectly, or you printed something to stdout
9 Incorrect 26 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
10 Incorrect 26 ms 2752 KB Program terminated incorrectly, or you printed something to stdout
11 Incorrect 27 ms 2908 KB Program terminated incorrectly, or you printed something to stdout
12 Incorrect 26 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
13 Incorrect 26 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
14 Incorrect 28 ms 2872 KB Program terminated incorrectly, or you printed something to stdout
15 Incorrect 26 ms 2840 KB Program terminated incorrectly, or you printed something to stdout
16 Incorrect 27 ms 2888 KB Program terminated incorrectly, or you printed something to stdout
17 Incorrect 39 ms 2792 KB Program terminated incorrectly, or you printed something to stdout
18 Incorrect 26 ms 2648 KB Program terminated incorrectly, or you printed something to stdout
19 Incorrect 39 ms 2884 KB Program terminated incorrectly, or you printed something to stdout
20 Incorrect 27 ms 2848 KB Program terminated incorrectly, or you printed something to stdout
21 Incorrect 38 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
22 Incorrect 25 ms 2768 KB Program terminated incorrectly, or you printed something to stdout
23 Incorrect 25 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
24 Incorrect 27 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
25 Incorrect 39 ms 2840 KB Program terminated incorrectly, or you printed something to stdout
26 Incorrect 26 ms 2804 KB Program terminated incorrectly, or you printed something to stdout
27 Incorrect 25 ms 2780 KB Program terminated incorrectly, or you printed something to stdout
28 Incorrect 26 ms 2748 KB Program terminated incorrectly, or you printed something to stdout
29 Incorrect 27 ms 2744 KB Program terminated incorrectly, or you printed something to stdout
30 Incorrect 26 ms 2876 KB Program terminated incorrectly, or you printed something to stdout
31 Incorrect 28 ms 2616 KB Program terminated incorrectly, or you printed something to stdout
32 Incorrect 26 ms 2892 KB Program terminated incorrectly, or you printed something to stdout
33 Incorrect 28 ms 2860 KB Program terminated incorrectly, or you printed something to stdout
34 Incorrect 26 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
35 Incorrect 26 ms 2864 KB Program terminated incorrectly, or you printed something to stdout
36 Incorrect 30 ms 2656 KB Program terminated incorrectly, or you printed something to stdout
37 Incorrect 30 ms 2956 KB Program terminated incorrectly, or you printed something to stdout
38 Incorrect 25 ms 2804 KB Program terminated incorrectly, or you printed something to stdout
39 Incorrect 28 ms 2744 KB Program terminated incorrectly, or you printed something to stdout
40 Incorrect 36 ms 2724 KB Program terminated incorrectly, or you printed something to stdout