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 "planet.h"
#include <algorithm>
using namespace std;
int calls;
void my_paint(int r,int c)
{
paint((r%2222+2222)%2222,(c%2222+2222)%2222);
}
int my_row(int r)
{
calls++;
return count_row((r%2222+2222)%2222);
}
int my_col(int c)
{
calls++;
return count_col((c%2222+2222)%2222);
}
void wait()
{
calls++;
count_row(0);
}
void my_report(int r,int c)
{
report((r%2222+2222)%2222,(c%2222+2222)%2222);
}
void ainta()
{
int i;
for(i=0;i<57;i++)my_paint(-i,-i);
for(i=57;i<100;i++)my_paint(0,-i);
my_paint(1,-1);
my_paint(1,-2);
my_paint(2,-2);
}
void sangsoo()
{
calls = 0;
int x,y;
int l,r,mid;
for(x=0;x+min(calls,57)<2222;x+=min(calls,57))if(my_row(x))break;
for(l=0,r=min(calls,57)-1;l<r;my_row(x+mid)?l=mid:r=mid-1)mid=(l+r+1)/2;
x+=l;
for(y=0;y+calls<2222;y+=calls)if(my_col(y))break;
for(l=0,r=calls-1;r-l>3;my_col(y+mid)?l=mid:r=mid-1)mid=(l+r+1)/2;
while(calls<102)wait();
y+=l;
y+=my_col(y+1);
my_report(x,y);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |