답안 #232804

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232804 2020-05-18T08:22:18 Z AlexLuchianov Broken Device (JOI17_broken_device) C++14
85 / 100
70 ms 3568 KB
#include "Annalib.h"
#include <iostream>

using ll = long long;
  namespace Alice{
  int const nmax = 150;
  int const modulo = 1000000007;
  int const base = 13;
  int const rest = 7;


  int block[1 + nmax];
  int v[1 + nmax];

  int root;

  int myrand(){
    root = (1LL * root * base + rest) % modulo;
    return root;
  }

  void staticshuffle(int n){
    for(int i = 0; i < n; i++)
      v[i] = i;
    for(int i = 0; i < 3 * n; i++){
      int x = myrand() % n;
      int y = myrand() % n;

      std::swap(v[x], v[y]);
    }
  }
}
using namespace Alice;

void Anna( int n, long long X, int k, int P[] ){
  root = 1;
  staticshuffle(n);

  for(int i = 0; i < n; i++)
    block[i] = 0;

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

  for(int i = 0; i < n; i += 2){
    if(X == 0 || block[v[i]] == 1 || block[v[i + 1]] == 1) {
      Set(v[i], 0);
      Set(v[i + 1], 0);
    } else {
      int number = X % 3 + 1;
      X /= 3;
      Set(v[i], (0 < (number & 2)));
      Set(v[i + 1], (number & 1));
    }
  }
}
#include "Brunolib.h"
#include <iostream>

using ll = long long;

namespace Ban{
  int const nmax = 150;
  int const modulo = 1000000007;
  int const base = 13;
  int const rest = 7;

  int v[1 + nmax];

  int root;

  int myrand(){
    root = (1LL * root * base + rest) % modulo;
    return root;
  }

  void staticshuffle(int n){
    for(int i = 0; i < n; i++)
      v[i] = i;
    for(int i = 0; i < 3 * n; i++){
      int x = myrand() % n;
      int y = myrand() % n;
      std::swap(v[x], v[y]);
    }
  }
}
using namespace Ban;

long long Bruno(int n, int A[] ){
  root = 1;
  staticshuffle(n);

  ll result = 0;
  for(int i = n - 2; 0 <= i; i -= 2){
    if(A[v[i]] == 0 && A[v[i + 1]] == 0) {
      continue;
    } else {
      int number = (A[v[i]]<<1) + A[v[i + 1]] - 1;
      result = result * 3 + number;
    }
  }
  return result;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 67 ms 3056 KB Output is partially correct - L* = 38
2 Partially correct 65 ms 3056 KB Output is partially correct - L* = 39
3 Partially correct 65 ms 3064 KB Output is partially correct - L* = 39
4 Partially correct 66 ms 3056 KB Output is partially correct - L* = 39
5 Partially correct 66 ms 3056 KB Output is partially correct - L* = 39
6 Partially correct 66 ms 3072 KB Output is partially correct - L* = 39
7 Partially correct 70 ms 3312 KB Output is partially correct - L* = 39
8 Partially correct 65 ms 3072 KB Output is partially correct - L* = 38
9 Partially correct 67 ms 3056 KB Output is partially correct - L* = 39
10 Partially correct 67 ms 3056 KB Output is partially correct - L* = 39
11 Correct 64 ms 3056 KB Output is correct - L* = 40
12 Correct 65 ms 3056 KB Output is correct - L* = 40
13 Partially correct 64 ms 3112 KB Output is partially correct - L* = 39
14 Partially correct 66 ms 3056 KB Output is partially correct - L* = 37
15 Partially correct 65 ms 3056 KB Output is partially correct - L* = 37
16 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
17 Partially correct 66 ms 3056 KB Output is partially correct - L* = 38
18 Partially correct 67 ms 3056 KB Output is partially correct - L* = 37
19 Partially correct 65 ms 3056 KB Output is partially correct - L* = 38
20 Partially correct 64 ms 3072 KB Output is partially correct - L* = 39
21 Partially correct 68 ms 3056 KB Output is partially correct - L* = 38
22 Partially correct 69 ms 3568 KB Output is partially correct - L* = 38
23 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
24 Partially correct 65 ms 3056 KB Output is partially correct - L* = 38
25 Partially correct 65 ms 3072 KB Output is partially correct - L* = 38
26 Partially correct 67 ms 3056 KB Output is partially correct - L* = 39
27 Partially correct 66 ms 3056 KB Output is partially correct - L* = 38
28 Partially correct 66 ms 3056 KB Output is partially correct - L* = 38
29 Partially correct 65 ms 3056 KB Output is partially correct - L* = 39
30 Partially correct 66 ms 3056 KB Output is partially correct - L* = 38
31 Partially correct 66 ms 3072 KB Output is partially correct - L* = 37
32 Partially correct 64 ms 3056 KB Output is partially correct - L* = 39
33 Partially correct 66 ms 3192 KB Output is partially correct - L* = 38
34 Partially correct 65 ms 3072 KB Output is partially correct - L* = 39
35 Partially correct 65 ms 3072 KB Output is partially correct - L* = 38
36 Partially correct 66 ms 3056 KB Output is partially correct - L* = 37
37 Partially correct 66 ms 3056 KB Output is partially correct - L* = 39
38 Partially correct 64 ms 3064 KB Output is partially correct - L* = 39
39 Correct 65 ms 3056 KB Output is correct - L* = 40
40 Partially correct 66 ms 3056 KB Output is partially correct - L* = 38