Submission #596377

# Submission time Handle Problem Language Result Execution time Memory
596377 2022-07-14T16:09:22 Z mosiashvililuka Hotter Colder (IOI10_hottercolder) C++14
77 / 100
2499 ms 8104 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){
    srand(time(0));
    a=NN;pas=0;pi=0;
    rec(1,a);
    return pas;
}
# Verdict Execution time Memory Grader output
1 Correct 231 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 236 ms 1296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 239 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 2499 ms 8104 KB Output is partially correct - alpha = 0.068965517241