Submission #990848

# Submission time Handle Problem Language Result Execution time Memory
990848 2024-05-31T13:43:22 Z abczz Broken Device (JOI17_broken_device) C++14
65 / 100
31 ms 2896 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));
    for (int j=bit; j<N; j+=2) {
      if (p+j >= N) break;
      if (!B[perm[p+j]]) {
        //cout << p+j << " ";
        //cout << i << " " << j << endl;
        //cout << j << " ";
        F[perm[p+j]] = 1;
        p += j+1;
        break;
      }
    }
  }
  //cout << endl;
  for (int i=0; i<N; ++i) {
    Set(i, F[i]);
  }
}
#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;
  }
  ll x = 805215019090496300;
  ll p = 0;
  for (int i=0; i<N; ++i) {
    if (A[i]) {
      V.push_back(par[i]);
    }
  }
  sort(V.begin(), V.end());
  int j = 0;
  for (int i=59; i>=0; --i) {
    //cout << V[j]-p << " ";
    if ((bool)((V[j]-p) & 1)) x ^= (1LL<<i);
    p = V[j++]+1;
    if (j == V.size()) break;
  }
  //cout << endl;
  //cout << x << endl;
  return x;
}

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:34:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     if (j == V.size()) break;
      |         ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 26 ms 2760 KB Output is partially correct - L* = 37
2 Partially correct 26 ms 2816 KB Output is partially correct - L* = 37
3 Partially correct 29 ms 2896 KB Output is partially correct - L* = 37
4 Partially correct 25 ms 2788 KB Output is partially correct - L* = 29
5 Partially correct 25 ms 2408 KB Output is partially correct - L* = 37
6 Partially correct 26 ms 2768 KB Output is partially correct - L* = 33
7 Partially correct 25 ms 2832 KB Output is partially correct - L* = 34
8 Partially correct 26 ms 2764 KB Output is partially correct - L* = 32
9 Partially correct 26 ms 2760 KB Output is partially correct - L* = 36
10 Partially correct 26 ms 2756 KB Output is partially correct - L* = 37
11 Partially correct 25 ms 2760 KB Output is partially correct - L* = 35
12 Partially correct 26 ms 2760 KB Output is partially correct - L* = 33
13 Partially correct 26 ms 2728 KB Output is partially correct - L* = 37
14 Partially correct 25 ms 2724 KB Output is partially correct - L* = 34
15 Partially correct 26 ms 2808 KB Output is partially correct - L* = 27
16 Partially correct 27 ms 2728 KB Output is partially correct - L* = 37
17 Partially correct 28 ms 2724 KB Output is partially correct - L* = 37
18 Partially correct 26 ms 2816 KB Output is partially correct - L* = 37
19 Partially correct 26 ms 2760 KB Output is partially correct - L* = 33
20 Partially correct 26 ms 2408 KB Output is partially correct - L* = 33
21 Partially correct 26 ms 2764 KB Output is partially correct - L* = 37
22 Partially correct 25 ms 2804 KB Output is partially correct - L* = 33
23 Partially correct 27 ms 2756 KB Output is partially correct - L* = 33
24 Partially correct 26 ms 2756 KB Output is partially correct - L* = 34
25 Partially correct 27 ms 2720 KB Output is partially correct - L* = 34
26 Partially correct 27 ms 2664 KB Output is partially correct - L* = 36
27 Partially correct 27 ms 2772 KB Output is partially correct - L* = 35
28 Partially correct 26 ms 2752 KB Output is partially correct - L* = 35
29 Partially correct 27 ms 2820 KB Output is partially correct - L* = 37
30 Partially correct 27 ms 2760 KB Output is partially correct - L* = 31
31 Partially correct 26 ms 2604 KB Output is partially correct - L* = 37
32 Partially correct 27 ms 2736 KB Output is partially correct - L* = 33
33 Partially correct 27 ms 2716 KB Output is partially correct - L* = 37
34 Partially correct 31 ms 2812 KB Output is partially correct - L* = 37
35 Partially correct 27 ms 2704 KB Output is partially correct - L* = 33
36 Partially correct 26 ms 2652 KB Output is partially correct - L* = 37
37 Partially correct 27 ms 2760 KB Output is partially correct - L* = 33
38 Partially correct 27 ms 2660 KB Output is partially correct - L* = 34
39 Partially correct 27 ms 2816 KB Output is partially correct - L* = 35
40 Partially correct 26 ms 2768 KB Output is partially correct - L* = 36