답안 #436599

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
436599 2021-06-24T16:43:15 Z Mamnoon_Siam Shopping (JOI21_shopping) C++17
10 / 100
115 ms 812 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second

namespace {

int N, L, R;
vi bits;
const int magic = 20;
int where = 0;

}  // namespace

void InitA(int N, int L, int R) {
  ::N = N;
  ::L = L;
  ::R = R;
  int LB = L / magic;
  int RB = R / magic;
  for(int i = 0; i < 9; ++i) {
    SendA(LB >> i & 1);
  }
  for(int i = 0; i < 9; ++i) {
    SendA(RB >> i & 1);
  }
  int cnt = 0;
  for(int i = LB*magic; i < min(N, (LB+1)*magic); ++i) {
    for(int j = RB*magic; j < min(N, (RB+1)*magic); ++j) {
      if(i == L and j == R) {
        where = cnt;
      }
      cnt++;
    }
  }
}

void ReceiveA(bool x) {
  bits.emplace_back(x);
}

int Answer() {
  int ret = 0;
  for(int i = 0; i < 14; ++i) {
    if(bits[14*where+i]) ret |= (1 << i);
  }
  return ret;
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second

namespace {

const int magic = 20;
int N;

int cnt = 0;
int LB = 0, RB = 0;
vi P;

}  // namespace

void InitB(int N, std::vector<int> P) {
  ::N = N;
  ::P = P;
}

void ReceiveB(bool y) {
  if(cnt < 9) {
    LB |= (int(y) << cnt);
  } else {
    RB |= (int(y) << (cnt - 9));
  }
  cnt++;
  if(cnt == 18) {
    for(int i = LB*magic; i < min(N, (LB+1)*magic); ++i) {
      for(int j = RB*magic; j < min(N, (RB+1)*magic); ++j) {
        ii mn = {INT_MAX, INT_MAX};
        for(int x = i; x <= j; ++x) {
          mn = min(mn, ii(P[x], x));
        }
        for(int x = 0; x < 14; ++x) {
          SendB(mn.se >> x & 1);
        }
      }
    }
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 464 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 4 ms 476 KB Output is correct
5 Correct 4 ms 480 KB Output is correct
6 Correct 52 ms 496 KB Output is correct
7 Correct 55 ms 476 KB Output is correct
8 Correct 50 ms 484 KB Output is correct
9 Correct 50 ms 472 KB Output is correct
10 Correct 82 ms 492 KB Output is correct
11 Correct 53 ms 468 KB Output is correct
12 Correct 79 ms 584 KB Output is correct
13 Correct 76 ms 516 KB Output is correct
14 Correct 34 ms 480 KB Output is correct
15 Correct 69 ms 512 KB Output is correct
16 Correct 53 ms 628 KB Output is correct
17 Correct 45 ms 492 KB Output is correct
18 Correct 59 ms 604 KB Output is correct
19 Correct 42 ms 512 KB Output is correct
20 Correct 85 ms 516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 464 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 4 ms 476 KB Output is correct
5 Correct 4 ms 480 KB Output is correct
6 Correct 52 ms 496 KB Output is correct
7 Correct 55 ms 476 KB Output is correct
8 Correct 50 ms 484 KB Output is correct
9 Correct 50 ms 472 KB Output is correct
10 Correct 82 ms 492 KB Output is correct
11 Correct 53 ms 468 KB Output is correct
12 Correct 79 ms 584 KB Output is correct
13 Correct 76 ms 516 KB Output is correct
14 Correct 34 ms 480 KB Output is correct
15 Correct 69 ms 512 KB Output is correct
16 Correct 53 ms 628 KB Output is correct
17 Correct 45 ms 492 KB Output is correct
18 Correct 59 ms 604 KB Output is correct
19 Correct 42 ms 512 KB Output is correct
20 Correct 85 ms 516 KB Output is correct
21 Correct 82 ms 716 KB Output is correct
22 Correct 50 ms 688 KB Output is correct
23 Correct 57 ms 708 KB Output is correct
24 Correct 74 ms 676 KB Output is correct
25 Correct 115 ms 708 KB Output is correct
26 Correct 88 ms 620 KB Output is correct
27 Correct 57 ms 812 KB Output is correct
28 Correct 49 ms 716 KB Output is correct
29 Correct 86 ms 680 KB Output is correct
30 Correct 70 ms 704 KB Output is correct
31 Correct 56 ms 800 KB Output is correct
32 Correct 36 ms 668 KB Output is correct
33 Correct 53 ms 696 KB Output is correct
34 Correct 48 ms 688 KB Output is correct
35 Correct 80 ms 708 KB Output is correct
36 Correct 71 ms 708 KB Output is correct
37 Correct 91 ms 684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 268 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -