Submission #390561

# Submission time Handle Problem Language Result Execution time Memory
390561 2021-04-16T10:12:53 Z Sorting Hotter Colder (IOI10_hottercolder) C++17
0 / 100
630 ms 8324 KB
#include "grader.h"
#include <bits/stdc++.h>

using namespace std;

int HC(int n){
    int l = 1, r = n;
    int prev = -1;
    while(l != r){
        //cout << l << " - " << r << endl;
        int mid = (l + r) >> 1;
        int cand = 2 * mid - prev, g;
        if(prev == -1) cand = -1;

        if(1 <= cand && cand <= n){
            //cout << "cand is here" << endl;
            g = Guess(cand);
            if(prev > mid) g = -g; 
            prev = cand;
        }
        else{
            if(n - r < l - 1){
                Guess(l);
                g = Guess(r);
                prev = r;
            }
            else{
                Guess(r);
                g = -Guess(l);
                prev = l;
            }
        }
        
        if(!g) return mid;

        if(g == -1) r = mid;
        else l = mid + 1;
    }
    return l;
}
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1356 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 1404 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1448 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 630 ms 8324 KB Output isn't correct - alpha = 0.000000000000