Submission #1200136

#TimeUsernameProblemLanguageResultExecution timeMemory
1200136moha1111Finding Routers (IOI20_routers)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
using namespace std;

map<int , int> askd;
int cun = 0;
int ask(int i)
{
    if(askd.find(i) != askd.end())
        return askd[i];

    cun++;
    cout << i << '\n';
    int y;
    cin >> y;
    return askd[i] = y;
}
int main()
{
    int l , n , q;
    cin >> l >> n >> q;
    vector<int> ans;
    ans.push_back(0);
    while(ans.size() < n)
    {
        int st = ans.back() , en = l , i = -1;
        while(st <= en)
        {
            int mid = (st + en) / 2;
            if(ask(mid) != ans.size() - 1)
                en = mid - 1;

            else
                st = mid + 1 , i = mid;
        }
        ans.push_back(2 * i);
        cout << "I " << 2 * i << endl;
    }
    cout << "cun " << cun << endl;
    for(auto i : ans)
        cout << i << ' ';
        
        
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cczEDV7u.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccckqqO4.o:routers.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cczEDV7u.o: in function `main':
grader.cpp:(.text.startup+0x21d): undefined reference to `find_routers(int, int, int)'
collect2: error: ld returned 1 exit status