Submission #596376

# Submission time Handle Problem Language Result Execution time Memory
596376 2022-07-14T16:08:20 Z mosiashvililuka Hotter Colder (IOI10_hottercolder) C++14
77 / 100
1004 ms 24420 KB
#include "grader.h"
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,pas,pi;
pair <int, int> p[1009];
int ask(int q){
    if(p[pi].first==q){
        return p[pi].second;
    }
    pi++;p[pi]={q,Guess(q)};
    return p[pi].second;
}
void rec(int q, int w){
    if(q==w){
        pas=q;
        return;
    }
    if(rand()%2){
        Guess(q);
        c=Guess(w);
        if(c==0){
            pas=(q+w)/2;
            return;
        }
        if(c==-1){
            int mid=0;
            if((q+w)%2!=0) mid=(q+w)/2; else mid=(q+w)/2-1;
            rec(q,mid);
        }else{
            int mid=0;
            mid=(q+w)/2+1;
            rec(mid,w);
        }
    }else{
        Guess(w);
        c=Guess(q);
        if(c==0){
            pas=(q+w)/2;
            return;
        }
        if(c==1){
            int mid=0;
            if((q+w)%2!=0) mid=(q+w)/2; else mid=(q+w)/2-1;
            rec(q,mid);
        }else{
            int mid=0;
            mid=(q+w)/2+1;
            rec(mid,w);
        }
    }
}
int HC(int NN){
    a=NN;pas=0;pi=0;
    rec(1,a);
    return pas;
}
# Verdict Execution time Memory Grader output
1 Correct 33 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 1304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 1292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 1004 ms 24420 KB Output is partially correct - alpha = 0.068965517241