Submission #819429

# Submission time Handle Problem Language Result Execution time Memory
819429 2023-08-10T10:42:44 Z Mohammed_Atalah Shopping (JOI21_shopping) C++17
10 / 100
93 ms 900 KB
#include "Anna.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {

int N, L, R;
int cnt;
vector<int> status;
int res;
}  // namespace

void InitA(int N, int L, int R) {
  ::N = N;
  ::L = L;
  ::R = R;
  res  = L;
  cnt  = 0;
  int l = L;
  for (int i  = 0; i <= 14; i ++) {
    if ((l >> i) & 1) {
      SendA(1);
    } else {
      SendA(0);
    }
  }
}


void getans() {
  for (int i = L; i <= R; i ++) {
    if (status[i]) {
      res = i;
    }
  }
}
void ReceiveA(bool x) {
  // cout << x << ' ';
  status.push_back(x);
  cnt++;
  if (cnt == N) {
    getans();
  }
}

int Answer() {
  return res;
}
#include "Bruno.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;

namespace {
int N;
vector<int> nums;
int cnt = 0;
int L = 0;
}

void minel() {

  for (int i  = 0; i < L; i ++) {
    SendB(0);
  }

  int mn = nums[L];
  SendB(1);
  for (int i = L + 1; i < N; i ++) {
    if (nums[i] < mn) {
      mn = nums[i];
      SendB(1);
    } else {
      SendB(0);
    }
  }
}

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

void ReceiveB(bool y) {
  if (y)
    L += pow(2, cnt);
  cnt++;
  if (cnt == 15) {
    minel();
  }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 440 KB Output is correct
2 Correct 1 ms 400 KB Output is correct
3 Correct 1 ms 480 KB Output is correct
4 Correct 1 ms 400 KB Output is correct
5 Correct 1 ms 400 KB Output is correct
6 Correct 11 ms 496 KB Output is correct
7 Correct 5 ms 492 KB Output is correct
8 Correct 9 ms 496 KB Output is correct
9 Correct 9 ms 400 KB Output is correct
10 Correct 5 ms 488 KB Output is correct
11 Correct 5 ms 492 KB Output is correct
12 Correct 8 ms 496 KB Output is correct
13 Correct 9 ms 488 KB Output is correct
14 Correct 9 ms 492 KB Output is correct
15 Correct 9 ms 496 KB Output is correct
16 Correct 5 ms 488 KB Output is correct
17 Correct 9 ms 400 KB Output is correct
18 Correct 9 ms 496 KB Output is correct
19 Correct 9 ms 400 KB Output is correct
20 Correct 9 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 440 KB Output is correct
2 Correct 1 ms 400 KB Output is correct
3 Correct 1 ms 480 KB Output is correct
4 Correct 1 ms 400 KB Output is correct
5 Correct 1 ms 400 KB Output is correct
6 Correct 11 ms 496 KB Output is correct
7 Correct 5 ms 492 KB Output is correct
8 Correct 9 ms 496 KB Output is correct
9 Correct 9 ms 400 KB Output is correct
10 Correct 5 ms 488 KB Output is correct
11 Correct 5 ms 492 KB Output is correct
12 Correct 8 ms 496 KB Output is correct
13 Correct 9 ms 488 KB Output is correct
14 Correct 9 ms 492 KB Output is correct
15 Correct 9 ms 496 KB Output is correct
16 Correct 5 ms 488 KB Output is correct
17 Correct 9 ms 400 KB Output is correct
18 Correct 9 ms 496 KB Output is correct
19 Correct 9 ms 400 KB Output is correct
20 Correct 9 ms 400 KB Output is correct
21 Correct 74 ms 704 KB Output is correct
22 Correct 74 ms 720 KB Output is correct
23 Correct 93 ms 772 KB Output is correct
24 Correct 39 ms 756 KB Output is correct
25 Correct 64 ms 684 KB Output is correct
26 Correct 83 ms 828 KB Output is correct
27 Correct 57 ms 832 KB Output is correct
28 Correct 76 ms 812 KB Output is correct
29 Correct 47 ms 712 KB Output is correct
30 Correct 49 ms 624 KB Output is correct
31 Correct 61 ms 728 KB Output is correct
32 Correct 60 ms 900 KB Output is correct
33 Correct 41 ms 732 KB Output is correct
34 Correct 88 ms 812 KB Output is correct
35 Correct 73 ms 672 KB Output is correct
36 Correct 63 ms 680 KB Output is correct
37 Correct 60 ms 704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 272 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -