Submission #231489

# Submission time Handle Problem Language Result Execution time Memory
231489 2020-05-13T19:20:20 Z muhammad_hokimiyon Hotter Colder (IOI10_hottercolder) C++14
77 / 100
659 ms 11572 KB
#include<bits/stdc++.h>
#include "grader.h"

using namespace std;

int HC(int nn)
{
    int Q = 0;
    int ls1 = 0;
    int l = 1 , r = nn;
    while( l < r ){
        int m = (l + r) / 2;
        if( l == 1 && r == 2 ){
            int x1 = Guess(1);
            int x2 = Guess(2);
            if( x2 == 1 )return 2;
            return 1;
        }
        int x1 = Guess(m - 1);
        int x2 = Guess(m + 1);
        if( x2 == 0 ){
            return m;
        }
        if( x2 == 1 )l = m + 1;
        else r = m - 1;
    }
    return l;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:14:17: warning: unused variable 'x1' [-Wunused-variable]
             int x1 = Guess(1);
                 ^~
hottercolder.cpp:19:13: warning: unused variable 'x1' [-Wunused-variable]
         int x1 = Guess(m - 1);
             ^~
hottercolder.cpp:8:9: warning: unused variable 'Q' [-Wunused-variable]
     int Q = 0;
         ^
hottercolder.cpp:9:9: warning: unused variable 'ls1' [-Wunused-variable]
     int ls1 = 0;
         ^~~
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 659 ms 11572 KB Output is partially correct - alpha = 0.068965517241