Submission #592359

# Submission time Handle Problem Language Result Execution time Memory
592359 2022-07-09T05:39:05 Z ogibogi2004 Hotter Colder (IOI10_hottercolder) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
int hist=-1;
int hidden;
int Guess(int g)
{
    if(hist==-1)
    {
        hist=g;
        return 0;
    }
    int dist1=abs(hidden-hist),dist2=abs(hidden-g);
    hist=g;
    if(dist1==dist2)return 0;
    if(dist1>dist2)return 1;
    return -1;
}
int HC(int N)
{
    srand(69);
    Guess(1);
    int last=1,l=1,r=N;
    while(l<r)
    {
        int mid=rand()%(r-l+1)+l;
        //cout<<l<<" "<<r<<" "<<mid<<endl;
        int t=Guess(mid);
        //cout<<t<<endl;
        int l1=N+1,r1=0;
        for(int j=l;j<=r;j++)
        {
            int dist1=abs(mid-j);
            int dist2=abs(last-j);
            if(t==0&&dist1==dist2)
            {
                l1=min(l1,j);
                r1=max(r1,j);
            }
            if(t==1&&dist1<dist2)
            {
                l1=min(l1,j);
                r1=max(r1,j);
            }
            if(t==-1&&dist1>dist2)
            {
                l1=min(l1,j);
                r1=max(r1,j);
            }
        }
        last=mid;
        l=l1;r=r1;
    }
    return l;
}

Compilation message

/usr/bin/ld: /tmp/ccxWc2g0.o: in function `Guess(int)':
grader.cpp:(.text+0x0): multiple definition of `Guess(int)'; /tmp/cc1sUad2.o:hottercolder.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status