Submission #45808

# Submission time Handle Problem Language Result Execution time Memory
45808 2018-04-16T07:28:10 Z OneSubmissionMan Hotter Colder (IOI10_hottercolder) C++11
77 / 100
762 ms 8312 KB
# include "grader.h"
# include <bits/stdc++.h>

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;

int solve_slow (int n) {
  int l = 1, r = n;
  while (l < r) {    
    int mid = (l+r) >> 1;    
    int res;
    Guess (l); res = Guess (r);
    if (!res)
      return mid;
    if (res < 0) 
      r = mid - (2*mid == l + r);
    else
      l = mid+1;
  }                           
  return l;
}       

int HC (int n) {
  return solve_slow (n);  
  if (n == 1)
    return 1;     
  int l, r, last;
  l = 1, r = n;
  Guess (n); last = n;          
      
  while (r - l > 1) {
    int m = (l+r) >> 1;
    cout << l << ' ' << r << endl;
    if (2*m <= last)
      m ++;
    int op, res;
    if (last == m) {   
      op = (l + m) / 2;
      cout << op << endl;
      res = -Guess (op);
    }   
    else {
      op = 2*m - last;
      cout << op << endl;
      res = Guess (op);
      if (last > m)
        res = -res;
    }
    cout <<  l << ' ' << r << ' ' << last << ' ' << op << ' ' << res << endl;
    if (!res)
      return m;
    if (res > 0)
      l = m;
    else
      r = m;

    last = op;
  }                                                                 
  if (l == r)
    return l;
  Guess (l);
  int res = Guess (r);
  if (res < 0)
    return l;
  else
    return r;   
}                                       
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 762 ms 8312 KB Output is partially correct - alpha = 0.068965517241