# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
558060 | groshi | Cave (IOI13_cave) | C++17 | 939 ms | 660 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<iostream>
#include<vector>
#include "cave.h"
using namespace std;
bool nwm[5010];
int s1[5010],d1[5010];///s to w ktora strone dobry pstryczek, d1 to ktore drzwi otwiera
/*int tryCombination(vector<int> Q)
{
for(int i=0;i<Q.size();i++)
cout<<Q[i]<<" ";
int x;
cin>>x;
return x;
}*/
void exploreCave(int n)
{
for(int i=0;i<n;i++)
{
int chce[n+3];
for(int j=0;j<n;j++)
{
if(nwm[j]==0)
chce[j]=0;
else chce[j]=s1[j];
}
//cout<<"wstepnie ";
int k=tryCombination(chce);
int on;
if(k!=i)///to znaczy ze s1[i]=0;
on=0;
else on=1;
//cout<<"drzwi "<<i<<" maja "<<on<<"\n";
int pocz=0,kon=n,sre,ostd;
while(pocz<kon)
{
//cout<<"sprawdzam przedzial "<<pocz<<" "<<kon<<"\n";
sre=(pocz+kon)/2;
for(int j=0;j<n;j++)
{
if(nwm[j]==1)
chce[j]=s1[j];
else{
if(j<pocz || j>sre)
chce[j]=on;
else chce[j]=!on;
}
}
int k=tryCombination(chce);
if(k==i)
{
//cout<<"w przedziale\n";
kon=sre;
ostd=sre;
}
else {
//cout<<"poza przedzialem\n";
pocz=sre+1;
}
}
s1[ostd]=on;
d1[ostd]=i;
nwm[ostd]=1;
}
answer(s1,d1);
/*for(int i=0;i<n;i++)
cout<<s1[i]<<" ";
cout<<"\n";
for(int i=0;i<n;i++)
cout<<d1[i]<<" ";*/
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |