Submission #990975

# Submission time Handle Problem Language Result Execution time Memory
990975 2024-06-01T02:04:08 Z abczz Broken Device (JOI17_broken_device) C++14
49 / 100
38 ms 2656 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 << X << endl;
  //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 Partially correct 25 ms 2392 KB Output is partially correct - L* = 21
2 Partially correct 25 ms 2396 KB Output is partially correct - L* = 21
3 Partially correct 25 ms 2396 KB Output is partially correct - L* = 23
4 Partially correct 26 ms 2656 KB Output is partially correct - L* = 22
5 Partially correct 24 ms 2532 KB Output is partially correct - L* = 23
6 Partially correct 27 ms 2392 KB Output is partially correct - L* = 23
7 Partially correct 26 ms 2396 KB Output is partially correct - L* = 23
8 Partially correct 37 ms 2620 KB Output is partially correct - L* = 21
9 Partially correct 30 ms 2484 KB Output is partially correct - L* = 22
10 Partially correct 26 ms 2476 KB Output is partially correct - L* = 19
11 Partially correct 24 ms 2396 KB Output is partially correct - L* = 23
12 Partially correct 24 ms 2392 KB Output is partially correct - L* = 22
13 Partially correct 36 ms 2396 KB Output is partially correct - L* = 23
14 Partially correct 24 ms 2572 KB Output is partially correct - L* = 22
15 Partially correct 33 ms 2396 KB Output is partially correct - L* = 22
16 Partially correct 26 ms 2392 KB Output is partially correct - L* = 21
17 Partially correct 27 ms 2472 KB Output is partially correct - L* = 25
18 Partially correct 27 ms 2396 KB Output is partially correct - L* = 23
19 Partially correct 30 ms 2580 KB Output is partially correct - L* = 22
20 Partially correct 24 ms 2392 KB Output is partially correct - L* = 25
21 Partially correct 25 ms 2484 KB Output is partially correct - L* = 22
22 Partially correct 24 ms 2396 KB Output is partially correct - L* = 23
23 Partially correct 33 ms 2392 KB Output is partially correct - L* = 23
24 Partially correct 25 ms 2396 KB Output is partially correct - L* = 23
25 Partially correct 30 ms 2396 KB Output is partially correct - L* = 23
26 Partially correct 28 ms 2396 KB Output is partially correct - L* = 21
27 Partially correct 38 ms 2392 KB Output is partially correct - L* = 21
28 Partially correct 27 ms 2396 KB Output is partially correct - L* = 21
29 Partially correct 24 ms 2400 KB Output is partially correct - L* = 22
30 Partially correct 24 ms 2480 KB Output is partially correct - L* = 24
31 Partially correct 36 ms 2480 KB Output is partially correct - L* = 22
32 Partially correct 36 ms 2308 KB Output is partially correct - L* = 23
33 Partially correct 26 ms 2400 KB Output is partially correct - L* = 22
34 Partially correct 27 ms 2436 KB Output is partially correct - L* = 22
35 Partially correct 25 ms 2380 KB Output is partially correct - L* = 24
36 Partially correct 24 ms 2392 KB Output is partially correct - L* = 23
37 Partially correct 24 ms 2484 KB Output is partially correct - L* = 20
38 Partially correct 24 ms 2396 KB Output is partially correct - L* = 20
39 Partially correct 29 ms 2480 KB Output is partially correct - L* = 24
40 Partially correct 24 ms 2396 KB Output is partially correct - L* = 22