Submission #1071753

# Submission time Handle Problem Language Result Execution time Memory
1071753 2024-08-23T10:49:31 Z TimDee Shopping (JOI21_shopping) C++17
1 / 100
7 ms 664 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0; i<n; ++i)

int la, ra;
void InitA(int n, int l, int r) {
  la = l, ra = r;
  forn(i,14) SendA((l>>i)&1);
  forn(i,4) SendA((r>>(i+10))&1);
}

int ai=-1;
int mn = -1;
void ReceiveA(bool x) {
  int b=x;
  if (ai==-1) {
    if (b) ++ai, mn=0;
    else ai=14;
    return;
  }
  if (ai<14) {
    mn+=b<<ai; ++ai; return;
  }
  if (la+ai-14 > ra) return;
  if (b) mn = la+ai-14;
  ++ai;
}

int Answer() {
  return mn;
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0; i<n; ++i)

const int N=1e6+5;
int a[N];
int n;
void InitB(int n, vector<int> a) {
  forn(i,n) ::a[i]=a[i];
  ::n=n;
}

int lq=0,rq=0;
int bi=0;
void ReceiveB(bool b) {
  int x = b;
  if (bi<14) {
    lq+=x<<bi;
  } else if (bi<18) {
    rq+=x<<(bi-4);
  }
  ++bi;
  if (bi==18) {
    int mn=-1;
    for(int i=lq; i<rq; ++i) {
      if (mn==-1) mn=i;
      if (a[i]<a[mn]) mn=i;
    }
    if (mn==-1) {
      SendB(0);
    } else {
      SendB(1);
      forn(i,14) SendB((mn>>i)&1);
    }
    for(int i=max(rq,lq); i<rq+1024; ++i) {
      if (mn==-1) mn=i;
      if (a[i]<a[mn]) mn=i;
      SendB(mn==i);
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 664 KB Output is correct
2 Correct 6 ms 664 KB Output is correct
3 Correct 6 ms 664 KB Output is correct
4 Correct 4 ms 664 KB Output is correct
5 Correct 6 ms 664 KB Output is correct
6 Correct 4 ms 664 KB Output is correct
7 Correct 6 ms 664 KB Output is correct
8 Correct 4 ms 664 KB Output is correct
9 Correct 3 ms 664 KB Output is correct
10 Correct 2 ms 664 KB Output is correct
11 Correct 6 ms 664 KB Output is correct
12 Correct 3 ms 664 KB Output is correct
13 Correct 3 ms 664 KB Output is correct
14 Correct 5 ms 664 KB Output is correct
15 Correct 6 ms 664 KB Output is correct
16 Correct 6 ms 664 KB Output is correct
17 Correct 7 ms 664 KB Output is correct
18 Correct 4 ms 664 KB Output is correct
19 Correct 2 ms 664 KB Output is correct
20 Correct 4 ms 664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 664 KB Output is correct
2 Correct 6 ms 664 KB Output is correct
3 Correct 6 ms 664 KB Output is correct
4 Correct 4 ms 664 KB Output is correct
5 Correct 6 ms 664 KB Output is correct
6 Correct 4 ms 664 KB Output is correct
7 Correct 6 ms 664 KB Output is correct
8 Correct 4 ms 664 KB Output is correct
9 Correct 3 ms 664 KB Output is correct
10 Correct 2 ms 664 KB Output is correct
11 Correct 6 ms 664 KB Output is correct
12 Correct 3 ms 664 KB Output is correct
13 Correct 3 ms 664 KB Output is correct
14 Correct 5 ms 664 KB Output is correct
15 Correct 6 ms 664 KB Output is correct
16 Correct 6 ms 664 KB Output is correct
17 Correct 7 ms 664 KB Output is correct
18 Correct 4 ms 664 KB Output is correct
19 Correct 2 ms 664 KB Output is correct
20 Correct 4 ms 664 KB Output is correct
21 Correct 6 ms 664 KB Output is correct
22 Correct 4 ms 664 KB Output is correct
23 Incorrect 5 ms 332 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -