# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
859963 | aykhn | Odd-even (IZhO11_oddeven) | C++14 | 1 ms | 860 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>
#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>;
const int MXN = 1e6 + 5;
const int B = 800;
int n;
string s;
deque<char> dq[B];
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
int n;
cin >> n;
int l = 1;
int r = 1e9;
while (l < r)
{
int mid = (l + r) >> 1;
if ((mid + 1) >= (2*n + mid - 1)/mid || mid * (mid + 1) / 2 >= n) r = mid;
else l = mid + 1;
}
int x = l - 1;
int y = n - 1;
cout << (y - x) * 2 + x + 1 << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |