Submission #1074264

# Submission time Handle Problem Language Result Execution time Memory
1074264 2024-08-25T09:11:31 Z beaconmc Hotter Colder (IOI10_hottercolder) C++14
0 / 100
2220 ms 262144 KB
#include "grader.h"
#include <bits/stdc++.h>

typedef long long ll;

#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(lli = x; i>y; i--)
using namespace std;

ll n;
map<ll,ll> sus;

int guess(ll a){
   if (sus.count(a)) return sus[a];

   if (a==0) return -1;
   if (a==n+1) return -1;
   return sus[a] = Guess(a);

}
int solve(int a, int b){
   //cout << a << " " << b << endl;

   if (a==b) return a;
   ll mid = (a+b)/2;
   ll midval = guess(mid);
   ll right = guess(mid+1);


   if (right == -1){
      return solve(a, mid);
   }else{
      return solve(mid+1, b);
   }
}


int HC(int N){
   n = N;
   ll ans = solve(1,N);
   return ans;
}

Compilation message

hottercolder.cpp: In function 'int solve(int, int)':
hottercolder.cpp:26:7: warning: unused variable 'midval' [-Wunused-variable]
   26 |    ll midval = guess(mid);
      |       ^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 82 ms 18000 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 97 ms 17856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 87 ms 18000 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2220 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -