# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
439261 | hossain2020 | Shopping (JOI21_shopping) | C++14 | 4 ms | 388 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anna.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
int n, l, r,k;
int c,o;
} // namespace
vector <long long > v;
void InitA(int N, int L, int R) {
n= N;
l= L;
r= R;
int a=r-l;
for (int i=0;i<18;i++)
{
SendA(l%2);
l/=2;
}
l=L;
}
void ReceiveA(bool x)
{
v.push_back(int(x));
}
int Answer() {
int o=0,s=0,k=l;
for (int i=0;i<v.size();)
{
s=0;
o=0;
for (int j=0;j<18;j++)
{
o+=(1<<s)*v[i];
i++;
s++;
}
o+=l;
if (o<=r)k=o;
}
return k;
}
#include "Bruno.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
int n;
int a[1000000];
int co,o,b,c;
}
void send(int y)
{
for (int i=0;i<18;i++)
{
SendB(y%2);
y/=2;
}
}
void InitB(int N, std::vector<int> P) {
n= N;
for(int i = 0; i < N; i++) {
a[i]= P[i];
}
}
void ReceiveB(bool y) {
o+=(1<<co)*int(y);
co++;
if (co==18)
{
b=a[o];
for (int i=o+1;i<n;i++)
{
if (a[i]<b)
{
b=a[i];
send(i-o);
}
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |