# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1045622 | ezzzay | Odd-even (IZhO11_oddeven) | C++14 | 0 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define pb push_back
#define endl "\n"
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())
typedef long long ll;
using namespace std;
const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(2e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;
ll n, l = 0, r = INF, ans;
ll calc(ll x) {return (x) * (x + 1) / 2ll;}
int main () {
ios_base :: sync_with_stdio (false); cin.tie(0);
//freopen(fname".in", "r", stdin);
//freopen(fname".out", "w", stdout);
scanf("%lld", &n);
while (r - l > 1) {
ll mid = (r + l) / 2ll;
if (calc(mid) >= n)
r = mid;
else
l = mid;
}
ans = n + (n - l - 1);
printf("%lld", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |