Submission #1090601

# Submission time Handle Problem Language Result Execution time Memory
1090601 2024-09-18T13:44:05 Z damas_code Hotter Colder (IOI10_hottercolder) C++17
0 / 100
533 ms 57608 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

int HC(int N){

    int l = 0, r = N-1; // it will return same

    int pg = r;
    int pp = Guess(pg);
    int g = (l+r)/2;
    int p = Guess(g);

    if (p == 1) r = ((pg + g)/2) -1; //hotter
    else if (p == 0) return (pg + g)/2; //same 
    else l = ((pg + g)/2) +1; //colder
    
    while (l < r){
        int pg = r;
        int pp = Guess(pg);
        int g = (l+r)/2;
        int p = Guess(g);

        if (p == 1) r = ((pg + g)/2) -1; //hotter
        else if (p == 0) return (pg + g) /2; //same 
        else l = ((pg + g)/2) +1; //colder

    }
    
    return l;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:20:13: warning: unused variable 'pp' [-Wunused-variable]
   20 |         int pp = Guess(pg);
      |             ^~
hottercolder.cpp:10:9: warning: unused variable 'pp' [-Wunused-variable]
   10 |     int pp = Guess(pg);
      |         ^~
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 5468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 5564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 5456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 533 ms 57608 KB Output isn't correct - alpha = 0.000000000000
2 Halted 0 ms 0 KB -