답안 #977829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
977829 2024-05-08T11:37:48 Z nguyentunglam Broken Device (JOI17_broken_device) C++17
0 / 100
195 ms 3004 KB
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;

namespace {
mt19937 rng(145);

const int m = 110, T = 60;

bitset<m + 1> a[T];

long long rnd(long long l, long long r) {
  return l + rng() % (r - l + 1);
}
}


void Anna( int n, long long x, int k, int P[] ){
  vector<long long> b(m);
  for(int i = 0; i < T; i++) {
    for(int j = 0; j < m; j++) a[i][j] = rnd(0, 1);
    a[i][m] = x >> i & 1;
  }

  vector<bool> broken(n, 0);

  for(int i = 0; i < k; i++) broken[P[i]] = 1;

  for(int i = 0; i < m; i++) if (broken[i]) {
    for(int j = 0; j < T; j++) a[j][i] = 0;
  }

  for(int i = 0; i < m; i++) {
    for(int j = 0; j < T; j++) if (a[j][i]) b[i] |= (1 << j);
  }

//  for(int i = 0; i < m; i++) cout << b[i] << endl;

  vector<int> pos(T, -1);

  for(int col = 0, row = 0; col < m && row < T; col++) {
    for(int i = row; i < T; i++) if (a[i][col]) {
      swap(a[i], a[row]);
      break;
    }
    if (a[row][col] == 0) continue;
    pos[row] = col;
    for(int i = 0; i < T; i++) if (i != row && a[i][col]) a[i] ^= a[row];
    row++;
  }

//  for(int i = 0; i < T; i++) cout << a[i] << endl;

  vector<int> ans(m, 0);


  for(int i = 0; i < T; i++) {
    int x = pos[i];
    ans[x] = a[i][m];
  }
  int Xor = 0;
  for(int i = 0; i < m; i++) if (ans[i]) Xor ^= b[i];
//  cout << Xor << endl;

  for(int i = 0; i < m; i++) Set(i, ans[i]);
  for(int i = m; i < n; i++) Set(i, 0);
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;

namespace {
mt19937 rng(145);

const int m = 110, T = 60;

bitset<m + 1> a[60];

long long rnd(long long l, long long r) {
  return l + rng() % (r - l + 1);
}

}


long long Bruno( int N, int A[] ){
//  vector<long long> b(m);
  for(int i = 0; i < T; i++) {
    for(int j = 0; j < m; j++) a[i][j] = rnd(0, 1);
  }
//
//  for(int i = 0; i < m; i++) {
//    for(int j = 0; j < T; j++) if (a[j][i]) b[i] |= (1 << j);
//  }

  long long ans = 0;

  for(int i = 0; i < T; i++) {
    int sum = 0;
    for(int j = 0; j < m; j++) if (A[j]) sum ^= a[i][j];
    if (sum) ans |= (1LL << i);
  }

//  cout << ans << endl;

  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 179 ms 2300 KB Output is correct - L* = 40
2 Correct 181 ms 2536 KB Output is correct - L* = 40
3 Correct 181 ms 2296 KB Output is correct - L* = 40
4 Correct 194 ms 2504 KB Output is correct - L* = 40
5 Correct 188 ms 2648 KB Output is correct - L* = 40
6 Correct 180 ms 2404 KB Output is correct - L* = 40
7 Correct 179 ms 2292 KB Output is correct - L* = 40
8 Correct 179 ms 2360 KB Output is correct - L* = 40
9 Correct 179 ms 2472 KB Output is correct - L* = 40
10 Correct 187 ms 2504 KB Output is correct - L* = 40
11 Correct 180 ms 2388 KB Output is correct - L* = 40
12 Correct 182 ms 2300 KB Output is correct - L* = 40
13 Runtime error 46 ms 1104 KB Execution killed with signal 6
14 Correct 178 ms 2468 KB Output is correct - L* = 40
15 Correct 181 ms 2400 KB Output is correct - L* = 40
16 Correct 180 ms 2376 KB Output is correct - L* = 40
17 Correct 184 ms 2704 KB Output is correct - L* = 40
18 Correct 182 ms 3004 KB Output is correct - L* = 40
19 Correct 180 ms 2532 KB Output is correct - L* = 40
20 Correct 179 ms 2328 KB Output is correct - L* = 40
21 Correct 180 ms 2300 KB Output is correct - L* = 40
22 Correct 181 ms 2312 KB Output is correct - L* = 40
23 Correct 183 ms 2552 KB Output is correct - L* = 40
24 Runtime error 46 ms 1008 KB Execution killed with signal 6
25 Correct 188 ms 2752 KB Output is correct - L* = 40
26 Correct 184 ms 2532 KB Output is correct - L* = 40
27 Correct 180 ms 2300 KB Output is correct - L* = 40
28 Correct 179 ms 2548 KB Output is correct - L* = 40
29 Correct 182 ms 2312 KB Output is correct - L* = 40
30 Correct 180 ms 2312 KB Output is correct - L* = 40
31 Correct 184 ms 2456 KB Output is correct - L* = 40
32 Correct 195 ms 2476 KB Output is correct - L* = 40
33 Runtime error 10 ms 604 KB Execution killed with signal 6
34 Correct 180 ms 2500 KB Output is correct - L* = 40
35 Correct 179 ms 2404 KB Output is correct - L* = 40
36 Correct 178 ms 2316 KB Output is correct - L* = 40
37 Correct 179 ms 2404 KB Output is correct - L* = 40
38 Correct 181 ms 2300 KB Output is correct - L* = 40
39 Correct 183 ms 2880 KB Output is correct - L* = 40
40 Correct 187 ms 2376 KB Output is correct - L* = 40