답안 #556623

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
556623 2022-05-03T12:34:34 Z MohamedFaresNebili Hotter Colder (IOI10_hottercolder) C++14
0 / 100
250 ms 16168 KB
#include <bits/stdc++.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) {
                int to = (lo + hi) / 2;
                if(to == pr) to = (lo + hi + 1) / 2;
              	while(to == pr) {
                  int calc = hi - lo;
                  to = rand() % calc + lo;
                }
 
                int r = Guess(to), md = abs(to - pr);
                if(md & 1) md++;
                if(to > pr) {
                    if(r == -1) hi = to - md / 2;
                    if(r == 0) return (to + pr) / 2;
                    if(r == 1) lo = pr + md / 2;
                }
                if(to < pr) {
                    if(r == -1) lo = to + md / 2;
                    if(r == 0) return (to + pr) / 2;
                    if(r == 1) hi = pr - md / 2;
                }
                pr = to;
            }
            return N;
        }
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 2388 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 2388 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 2384 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 250 ms 16168 KB Execution killed with signal 8