#include<bits/stdc++.h>
#include "cielib.h"
using namespace std;
int d,r,k,s,pomoc[1000],ostatni,heh;
int binsercz(int l,int p,int j)
{
int s=(l+p)/2;
if(s==0)
return 0;
if(s==r)
return r;
if(l==p)
return s;
pomoc[j]=ostatni;
heh=czyCieplo(pomoc);
pomoc[j]=s;
//printf("%d %d %d %d\n",l,s,p,ostatni);
if(czyCieplo(pomoc)==1)
{
ostatni=s;
pomoc[j]=s+1;
//printf("s%d ",czyCieplo(pomoc));
if(czyCieplo(pomoc)==1)
{
//printf("jaknajbardziej\n");
return binsercz(s+1,p,j);
}
else
{
//printf("NEEE");
return binsercz(l,s,j);
}
}
else
{
pomoc[j]=s+1;
//printf("s%d ",czyCieplo(pomoc));
if(czyCieplo(pomoc)==1)
{
//printf("jaknajbardziej\n");
return binsercz(s+1,p,j);
}
else
{
//printf("NEEE");
return binsercz(l,s,j);
}
}
}
int main()
{
/*
podajD()
podajK()
podajR()
czyCieplo({,}) false
nalazlem({})
*/
d=podajD();
k=podajK();
r=podajR();
int pozycja[d];
for(int i=0;i<d;i++)
{
pozycja[i]=0;
}
//printf("d%d ",czyCieplo(pozycja));
//pozycja[0]=1;
//printf("d%d ",czyCieplo(pozycja));
for(int i=0;i<d;i++)
{
ostatni=0;
pozycja[d]=binsercz(0,r+1,i);
}
znalazlem(pozycja);
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #include<bits/stdc++.h> #include "cielib.h" using namespace std; int d,r,k,s,pomoc[1000],ostatni,heh; int binsercz(int l,int p,int j) { int s=(l+p)/2; if(s==0) return 0; if(s==r) return r; if(l==p) return s; pomoc[j]=ostatni; heh=czyCieplo(pomoc); pomoc[j]=s; //printf("%d %d %d %d\n",l,s,p,ostatni); if(czyCieplo(pomoc)==1) { ostatni=s; pomoc[j]=s+1; //printf("s%d ",czyCieplo(pomoc)); if(czyCieplo(pomoc)==1) { //printf("jaknajbardziej\n"); return binsercz(s+1,p,j); } else { //printf("NEEE"); return binsercz(l,s,j); } } else { pomoc[j]=s+1; //printf("s%d ",czyCieplo(pomoc)); if(czyCieplo(pomoc)==1) { //printf("jaknajbardziej\n"); return binsercz(s+1,p,j); } else { //printf("NEEE"); return binsercz(l,s,j); } } } int main() { /* podajD() podajK() podajR() czyCieplo({,}) false nalazlem({}) */ d=podajD(); k=podajK(); r=podajR(); int pozycja[d]; for(int i=0;i<d;i++) { pozycja[i]=0; } //printf("d%d ",czyCieplo(pozycja)); //pozycja[0]=1; //printf("d%d ",czyCieplo(pozycja)); for(int i=0;i<d;i++) { ostatni=0; pozycja[d]=binsercz(0,r+1,i); } znalazlem(pozycja); } |
English