Submission #1209507

#TimeUsernameProblemLanguageResultExecution timeMemory
1209507emptypringlescanShopping (JOI21_shopping)C++17
10 / 100
64 ms12368 KiB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

namespace {

int N, L, R;
int count;
vector<int> recv;
}  // namespace

void InitA(int N, int L, int R) {
  ::N = N;
  ::L = L;
  ::R = R;
  for(int i=0; i<18; i++) SendA((L>>i)&1);
}

void ReceiveA(bool x) {
	if(x) recv.push_back(1);
	else recv.push_back(0);
}

int Answer() {
	for(int i=R; i>=L; i--) if(recv[i]) return i;
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace {

int N;
int arr[1000000];
int cn;

bool FunctionExample(bool P) {
  return !P;
}
vector<int> recv;
}  // namespace

void InitB(int N, std::vector<int> P) {
  ::N = N;
  for(int i = 0; i < N; i++) {
    arr[i] = P[i];
  }
  cn = 0;
}

void ReceiveB(bool y) {
  cn++;
  if(y) recv.push_back(1);
  else recv.push_back(0);
  if(cn==18){
	  int l=0;
	  for(int i=0; i<18; i++) if(recv[i]) l^=(1<<i);
	  int mx=1e9;
	  for(int i=0; i<l; i++) SendB(false);
	  for(int i=l; i<N; i++){
		  if(arr[i]<mx){
			  SendB(true);
			  mx=arr[i];
			 }
			 else SendB(false);
		 }
		}
}

Compilation message (stderr)

# 1번째 컴파일 단계

Anna.cpp: In function 'int Answer()':
Anna.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...