Submission #859966

# Submission time Handle Problem Language Result Execution time Memory
859966 2023-10-11T09:00:21 Z aykhn Odd-even (IZhO11_oddeven) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

// author : aykhn

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define int ll
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

__int128 read() {
    __int128 x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}
void print(__int128 x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    if (x > 9) print(x / 10);
    putchar(x % 10 + '0');
}


signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    __int128 n;
    n = read();
    __int128 l = 1; 
    __int128 r = 1e9;
    int INF = 2e18;
    while (l < r)
    {
        __int128 mid = (l + r) >> 1;
        if ((mid + 1) >= (INF + mid - 1)/mid || mid * (mid + 1) / 2 >= n) r = mid;
        else l = mid + 1;
    }
    __int128 x = l - 1;
    __int128 y = n - 1;
    print((y - x) * 2 + x + 1) << '\n';
}

Compilation message

oddeven.cpp: In function 'int main()':
oddeven.cpp:65:32: error: invalid operands of types 'void' and 'char' to binary 'operator<<'
   65 |     print((y - x) * 2 + x + 1) << '\n';
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~
      |          |                        |
      |          void                     char