답안 #439431

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
439431 2021-06-29T23:33:12 Z zaneyu Hotter Colder (IOI10_hottercolder) C++14
50 / 100
705 ms 24372 KB
#include "grader.h"
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long,null_type,less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("O2","unroll-loops","no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll=long long;
using ld=long double;
using pii=pair<ld,ld>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()),c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=1e18+1;
const int INF=0x3f3f3f3f;
const ll MOD=998244353;
const ld PI=acos(-1);
const ld eps=1e-3;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
inline ll mult(ll a,ll b){
    if(a>=MOD) a%=MOD;
    if(b>=MOD) b%=MOD;
    return (a*b)%MOD;
}
inline ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
const int maxn=1e3+5;
const int maxlg=__lg(maxn)+2;
int HC(int n){
   if(n==1) return 1;
   if(n==2){
      Guess(1);
      if(Guess(2)==1) return 2;
      return 1; 
   }
   int l=1,r=n;
   int x=(l+r)/2;
   while(l<r){
      int mid=(l+r)/2;
      Guess(mid);
      if(mid==n) return n;
      int z=Guess(mid+1);
      if(z==-1) r=mid;
      else if(z==1) l=mid+1;
   }
   return l;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:56:8: warning: unused variable 'x' [-Wunused-variable]
   56 |    int x=(l+r)/2;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 1348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 1228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 1296 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 705 ms 24372 KB Output isn't correct - alpha = 0.000000000000