# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
721272 | vjudge1 | Uzastopni (COCI17_uzastopni) | C++17 | 112 ms | 65536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ld long double
#define ll long long
#define S second
#define F first
using namespace __gnu_pbds;
using namespace std;
typedef tree<long long, null_type, less_equal<long long>,
rb_tree_tag, tree_order_statistics_node_update> Tree;
const ll INF = 9223372036854775807LL;
const ll inf = 2147483647;
const ll MAXN = 200010;
const ll MOD = 1e9 + 7;
const ld PI = acos(-1);
const ll NROOT = 320;
ll binpow(ll a, ll b) {
ll res = 1;
for (;b; b /= 2, a *= a, a %= MOD)
if (b & 1) res *= a, res %= MOD;
return res % MOD;
}
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a * b / gcd(a, b);}
ll invmod(ll a) {return binpow(a, MOD - 2);}
int bs(ll x, vector<ll> &v) {
int l = 0, r = v.size() - 1;
while (l <= r) {
int m = (l + r) / 2;
if (v[m] == x) return m;
if (v[m] < x) l = m + 1;
if (v[m] > x) r = m - 1;
}
return -1;
}
int32_t main () {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll n; cin >> n;
vector<ll> ans(1);
for (int i = 1; i <= n; i ++) {
ans.push_back(ans.back() + i);
}
for (int i = 1; i < ans.size(); i ++) {
ll pd = bs(ans[i - 1] + n, ans);
if (pd != -1 && pd != i) {
cout << i << " " << pd << '\n';
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |