답안 #1071758

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071758 2024-08-23T10:56:56 Z TimDee Shopping (JOI21_shopping) C++17
1 / 100
8 ms 1100 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<=min(rq+1024,n-1); ++i) {
      if (mn==-1) mn=i;
      if (a[i]<a[mn]) mn=i;
      SendB(mn==i);
    }
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 664 KB Output is correct
2 Correct 1 ms 664 KB Output is correct
3 Correct 0 ms 664 KB Output is correct
4 Correct 1 ms 664 KB Output is correct
5 Correct 1 ms 664 KB Output is correct
6 Correct 6 ms 664 KB Output is correct
7 Correct 5 ms 664 KB Output is correct
8 Correct 5 ms 664 KB Output is correct
9 Correct 2 ms 664 KB Output is correct
10 Correct 5 ms 664 KB Output is correct
11 Correct 5 ms 664 KB Output is correct
12 Correct 2 ms 664 KB Output is correct
13 Correct 3 ms 664 KB Output is correct
14 Correct 4 ms 664 KB Output is correct
15 Correct 3 ms 1100 KB Output is correct
16 Correct 8 ms 664 KB Output is correct
17 Correct 6 ms 664 KB Output is correct
18 Correct 5 ms 664 KB Output is correct
19 Correct 3 ms 664 KB Output is correct
20 Correct 5 ms 664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 664 KB Output is correct
2 Correct 1 ms 664 KB Output is correct
3 Correct 0 ms 664 KB Output is correct
4 Correct 1 ms 664 KB Output is correct
5 Correct 1 ms 664 KB Output is correct
6 Correct 6 ms 664 KB Output is correct
7 Correct 5 ms 664 KB Output is correct
8 Correct 5 ms 664 KB Output is correct
9 Correct 2 ms 664 KB Output is correct
10 Correct 5 ms 664 KB Output is correct
11 Correct 5 ms 664 KB Output is correct
12 Correct 2 ms 664 KB Output is correct
13 Correct 3 ms 664 KB Output is correct
14 Correct 4 ms 664 KB Output is correct
15 Correct 3 ms 1100 KB Output is correct
16 Correct 8 ms 664 KB Output is correct
17 Correct 6 ms 664 KB Output is correct
18 Correct 5 ms 664 KB Output is correct
19 Correct 3 ms 664 KB Output is correct
20 Correct 5 ms 664 KB Output is correct
21 Correct 6 ms 664 KB Output is correct
22 Correct 7 ms 916 KB Output is correct
23 Incorrect 5 ms 332 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 392 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -