Submission #556705

# Submission time Handle Problem Language Result Execution time Memory
556705 2022-05-03T17:48:29 Z MohamedFaresNebili Hotter Colder (IOI10_hottercolder) C++14
50 / 100
553 ms 8000 KB
#include <bits/stdc++.h>
#include "grader.h"
 
        using namespace std;
 
        using ll = long long;
        using ii = pair<ll, ll>;
        using vi = vector<int>;
 
        #define ff first
        #define ss second
        #define pb push_back
        #define all(x) (x).begin(), (x).end()
        #define lb lower_bound
        /// #define int ll
 
        const int oo = 1e9 + 7;
 
        int Guess(int v);
 
        int HC(int N) {
            int lo = 1, hi = N, pr = 1; Guess(1);
            while(lo <= hi) {
                if(lo == hi) return lo;
                int to = (lo + hi) / 2;
 
              	if(to == pr && to - 1 >= lo) to--;
              	if(to == pr && to + 1 <= hi) to++;
              	if(to == pr) return to;
 
                int r = Guess(to), md = abs(to - pr);
                if(md & 1) md++;
                if(to > pr) {
                    if(r == -1) hi = min(hi, to - md / 2);
                    if(r == 0) return (to + pr) / 2;
                    if(r == 1) lo = max(lo, pr + md / 2);
                }
                if(to < pr) {
                    if(r == -1) lo = max(lo, to + md / 2);
                    if(r == 0) return (to + pr) / 2;
                    if(r == 1) hi = min(hi, pr - md / 2);
                }
                pr = to;
            }
            return N;
        }
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 1280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 553 ms 8000 KB Output isn't correct - alpha = 0.000000000000