# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
859963 | aykhn | Odd-even (IZhO11_oddeven) | C++14 | 1 ms | 860 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |