답안 #151831

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151831 2019-09-05T04:46:32 Z davitmarg Hotter Colder (IOI10_hottercolder) C++17
25 / 100
957 ms 8312 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <stack>
#include <cassert>
#include <iterator>
#include <bitset>
#include <fstream>
#define mod 1000000007ll
#define LL long long  
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
using namespace std;
#ifndef death
    #include "grader.h";
#endif

#ifdef death


int Guess(int a)
{
    cout<<"! "<<a<<endl;
    int res;
    cin>>res;
    return res; 
}

#endif

int HC(int n)
{
    int l=1;
    int r=n;
    int m1,m2;
    int ans;
    while(l<=r)
    {
        if(l==r)
        {
            ans=l;
            break;
        }
        int len=(r-l);
        m1=l+len/3;
        m2=r-len/3;
        int a2;
        a2=Guess(m1);
        a2=Guess(m2);
        if(a2==-1)
            r=m2-1;
        else if(a2==1)
            l=m1+1;
        else
        {
            l=m1+1;
            r=m2-1;
        }
    }
    return ans;
}


#ifdef death

int main()
{
    

    cout<<HC(2)<<endl;
   
    return 0;
}

#endif

 
/*

 
*/ 

Compilation message

hottercolder.cpp:26:24: warning: extra tokens at end of #include directive
     #include "grader.h";
                        ^
hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:71:12: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return ans;
            ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 37 ms 1272 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 1272 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 957 ms 8312 KB Output isn't correct - alpha = 0.000000000000