Submission #1202537

#TimeUsernameProblemLanguageResultExecution timeMemory
1202537browntoadFinding Routers (IOI20_routers)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
// #define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define RREP1(i, n) for (int i = (n); i >= 1; i--)
#define REP1(i, n) FOR(i, 1, n+1)
#define pii pair<int, int>
#define ppi pair<pii, int>
#define pip pair<int, pii>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
#define endl '\n'
#define IOS() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

const ll maxn = 2e6+5;
const ll mod = 998244353;
const ll inf = (1ll<<60);
const int iinf = 1e9+5;

ll pw(ll x, ll p, ll m){
    ll ret = 1;
    x %= m;
    while(p > 0){
        if (p & 1){
            ret *= x;
            ret %= m;
        }
        x *= x;
        x %= m;
        p >>= 1;
    }
    return ret;
}
ll inv(ll x, ll m){
    return pw(x, m-2, m);
}

signed main(){
    // consider a binary tree, the number of queries approx  = union of all the chosen leaves to their parents's nodes
    int toad = 17;
    int cnt = 0;
    int n = 1000;
    n--; cnt += toad;
    toad--;

    int pw = 1;
    while(n > 0){
        int sub = min(n, pw);
        cnt += toad * sub;
        n -= sub;

        pw *= 2;
        toad--;
    }

    cout<<cnt<<endl;
}

Compilation message (stderr)

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