Submission #415438

# Submission time Handle Problem Language Result Execution time Memory
415438 2021-06-01T05:54:38 Z 조영욱(#7635) Shopping (JOI21_shopping) C++17
0 / 100
2 ms 192 KB
#include "Anna.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;

namespace {

int N, L, R;
int l,r;
int count;
vector<int> v;
}  // namespace

void InitA(int N, int L, int R) {
  ::N = N;
  ::L = L;
  ::R = R;
    l=(L*512)/1000000;
    r=(R*512)/1000000;
    for(int i=0;i<9;i++) {
        SendA((l>>i)&1);
    }
    for(int i=0;i<9;i++) {
        SendA((r>>i)&1);
    }
}

void ReceiveA(bool x) {
    v.push_back(x);
}

int Answer() {
    int ind=0;
    int ret=1048575;
    bool flag=false;
    for(int i=0;i<N;i++) {
        int now=(i*512)/1000000;
        if (now==l) {
            if (i>=L) {
                int val=0;
                for(int j=0;j<20;j++) {
                    val+=(v[ind+j]<<j);
                }
                ret=min(ret,val);
            }
            ind+=20;
        }
        else if (now==r) {
            if (!flag) {
                int val=0;
                for(int j=0;j<20;j++) {
                    val+=(v[ind+j]<<j);
                }
                flag=true;
                ret=min(ret,val);
                ind+=20;
            }
            if (i<=R) {
                int val=0;
                for(int j=0;j<20;j++) {
                    val+=(v[ind+j]<<j);
                }
                ret=min(ret,val);
            }
            ind+=20;
        }
    }
    return ret;
}
#include "Bruno.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;

namespace {

int N;
int variable_example[1000000];
int cnt;
vector<int> vec;
bool FunctionExample(bool P) {
  return !P;
}
int l,r;
}  // namespace

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

void ReceiveB(bool y) {
    if (cnt<9) {
        l+=(y<<cnt);
    }
    else {
        r+=(y<<(cnt-9));
    }
    cnt++;
    int mn=1048575;
    bool flag=false;
    if (cnt==18) {
        for(int i=0;i<N;i++) {
            int now=(i*512)/1000000;
            if (now==l) {
                for(int j=0;j<20;j++) {
                    SendB((vec[i]>>j)&1);
                }
            }
            else if (now>l&&now<r) {
                mn=min(mn,vec[i]);
            }
            else if (now==r) {
                if (!flag) {
                    for(int j=0;j<20;j++) {
                        SendB((mn>>j)&1);
                    }
                    flag=true;
                }
                for(int j=0;j<20;j++) {
                    SendB((vec[i]>>j)&1);
                }
            }
        }
    }
}

Compilation message

Anna.cpp:10:5: warning: '{anonymous}::count' defined but not used [-Wunused-variable]
   10 | int count;
      |     ^~~~~

Bruno.cpp:12:6: warning: 'bool {anonymous}::FunctionExample(bool)' defined but not used [-Wunused-function]
   12 | bool FunctionExample(bool P) {
      |      ^~~~~~~~~~~~~~~
Bruno.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 | int variable_example[1000000];
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 192 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 192 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 192 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -