답안 #990843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
990843 2024-05-31T13:37:41 Z abczz Broken Device (JOI17_broken_device) C++14
0 / 100
3 ms 860 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 (!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;
  }
  //cout << endl;
  //cout << x << endl;
  return x;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 7
2 Runtime error 2 ms 604 KB Execution killed with signal 7
3 Runtime error 1 ms 600 KB Execution killed with signal 7
4 Runtime error 1 ms 604 KB Execution killed with signal 7
5 Runtime error 3 ms 860 KB Execution killed with signal 7
6 Runtime error 1 ms 604 KB Execution killed with signal 7
7 Runtime error 1 ms 604 KB Execution killed with signal 7
8 Runtime error 1 ms 604 KB Execution killed with signal 7
9 Runtime error 1 ms 600 KB Execution killed with signal 7
10 Runtime error 1 ms 604 KB Execution killed with signal 7
11 Runtime error 1 ms 600 KB Execution killed with signal 7
12 Runtime error 1 ms 604 KB Execution killed with signal 7
13 Runtime error 1 ms 604 KB Execution killed with signal 7
14 Runtime error 1 ms 604 KB Execution killed with signal 7
15 Runtime error 1 ms 452 KB Execution killed with signal 7
16 Runtime error 1 ms 604 KB Execution killed with signal 7
17 Runtime error 1 ms 604 KB Execution killed with signal 7
18 Runtime error 2 ms 604 KB Execution killed with signal 7
19 Runtime error 1 ms 600 KB Execution killed with signal 7
20 Runtime error 1 ms 860 KB Execution killed with signal 7
21 Runtime error 1 ms 448 KB Execution killed with signal 7
22 Runtime error 1 ms 604 KB Execution killed with signal 7
23 Runtime error 1 ms 600 KB Execution killed with signal 7
24 Runtime error 1 ms 604 KB Execution killed with signal 7
25 Runtime error 1 ms 604 KB Execution killed with signal 7
26 Runtime error 1 ms 604 KB Execution killed with signal 7
27 Runtime error 1 ms 604 KB Execution killed with signal 7
28 Runtime error 1 ms 600 KB Execution killed with signal 7
29 Runtime error 1 ms 604 KB Execution killed with signal 7
30 Runtime error 1 ms 604 KB Execution killed with signal 7
31 Runtime error 1 ms 348 KB Execution killed with signal 7
32 Runtime error 1 ms 604 KB Execution killed with signal 7
33 Runtime error 1 ms 604 KB Execution killed with signal 7
34 Runtime error 1 ms 604 KB Execution killed with signal 7
35 Runtime error 1 ms 604 KB Execution killed with signal 7
36 Runtime error 1 ms 604 KB Execution killed with signal 7
37 Runtime error 1 ms 348 KB Execution killed with signal 7
38 Runtime error 1 ms 604 KB Execution killed with signal 7
39 Runtime error 2 ms 604 KB Execution killed with signal 7
40 Runtime error 1 ms 348 KB Execution killed with signal 7