Submission #1074484

# Submission time Handle Problem Language Result Execution time Memory
1074484 2024-08-25T10:45:54 Z DeathIsAwe Hotter Colder (IOI10_hottercolder) C++17
0 / 100
4802 ms 262144 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int ans = -1;


void destroy(int top, int bottom, int previous) {
   cout << top << ' ' << bottom << ' ' << previous << '\n';
   if (top - bottom == 0) {
      ans = top;
      return;
   } else if (top - bottom == 1) {
      int sussy;
      if (previous == -1) {
         Guess(top); sussy = Guess(bottom);
      } else if (previous == top) {
         sussy = Guess(bottom);
      } else {
         sussy = -Guess(top);
      }
      if (sussy == 1) {
         ans = bottom;
      } else {
         ans = top;
      }
      return;
   }
   int mid = (top + bottom) / 2;
   int midleft = (bottom + mid) / 2;
   int midright = (mid + 1 + top) / 2;
   if (previous == -1) {
      int midleftans = Guess(midleft), midrightans = Guess(midright);
      if (midrightans == 0) {
         ans = (midleft + midright) / 2;
      } else  if (midrightans == 1) {
         destroy(top, mid + 1, -1);
      } else {
         destroy(mid, bottom, -1);
      }
   }
}


int HC(int n){
   destroy(n, 1, -1);
   cout << ans << '\n';
   return ans;
}

Compilation message

hottercolder.cpp: In function 'void destroy(int, int, int)':
hottercolder.cpp:32:11: warning: unused variable 'midleftans' [-Wunused-variable]
   32 |       int midleftans = Guess(midleft), midrightans = Guess(midright);
      |           ^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 208 ms 11344 KB 잘못된 접근입니다.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 181 ms 11348 KB 잘못된 접근입니다.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 181 ms 11348 KB 잘못된 접근입니다.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4802 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -