Submission #596917

# Submission time Handle Problem Language Result Execution time Memory
596917 2022-07-15T09:18:40 Z keta_tsimakuridze Hotter Colder (IOI10_hottercolder) C++14
50 / 100
2473 ms 8140 KB
#include<bits/stdc++.h>
#define f first
#include "grader.h"
#define s second
#define pii pair<int,int>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7; // !
int t;
int HC(int n) {
    srand(time(0));
    int l = 1, r = n, ans = 1, last = -1;
    while(l != r) {
        if(rand() % 2) {
            if(last != l) Guess(l);
            int x = Guess(r); last = r;
            if(!x) return (l + r) / 2;
            if(x == 1) l = (l + r) / 2 +  1;
            else r = (l + r) / 2;
            continue;
        }
        if(last != r) Guess(r);
        int x = Guess(l); last = l;
        if(!x) return (l + r) / 2;
        if(x == -1) l = (l + r) / 2 +  1;
        else r = (l + r) / 2;

    }
    return l;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:11:23: warning: unused variable 'ans' [-Wunused-variable]
   11 |     int l = 1, r = n, ans = 1, last = -1;
      |                       ^~~
# Verdict Execution time Memory Grader output
1 Correct 235 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 240 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 239 ms 1284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2473 ms 8140 KB Output isn't correct - alpha = 0.000000000000