답안 #232799

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

using ll = long long;
  namespace Alice{
  int const nmax = 200;
  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 < 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 = 200;
  int const modulo = 1000000007;
  int const base = 13;
  int const rest = 7;

  int v[1 + nmax];

  int root;

  int myrand(){
    root = (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 = (v[i]<<1) + v[i + 1] - 1;
      result = result * 3 + number;
    }
  }
  return result;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 37 ms 3328 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 40 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 39 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 37 ms 3320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 38 ms 3328 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 39 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 39 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 38 ms 3320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 40 ms 3568 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 38 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 39 ms 3184 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 39 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 40 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 37 ms 3312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 38 ms 3328 KB Execution killed with signal 11 (could be triggered by violating memory limits)