結果
問題 | No.648 お や す み |
ユーザー | lskjfsdhj |
提出日時 | 2019-09-10 23:04:03 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,482 ms / 2,000 ms |
コード長 | 5,466 bytes |
コンパイル時間 | 1,246 ms |
コンパイル使用メモリ | 115,280 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-02 16:40:57 |
合計ジャッジ時間 | 82,823 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 1,382 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 1,364 ms
5,376 KB |
testcase_04 | AC | 1,348 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 1,380 ms
5,376 KB |
testcase_07 | AC | 1,376 ms
5,376 KB |
testcase_08 | AC | 1,346 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 1,375 ms
5,376 KB |
testcase_11 | AC | 1,357 ms
5,376 KB |
testcase_12 | AC | 1,360 ms
5,376 KB |
testcase_13 | AC | 1,363 ms
5,376 KB |
testcase_14 | AC | 1,366 ms
5,376 KB |
testcase_15 | AC | 1,359 ms
6,944 KB |
testcase_16 | AC | 1,365 ms
6,940 KB |
testcase_17 | AC | 1,343 ms
6,940 KB |
testcase_18 | AC | 1,349 ms
6,944 KB |
testcase_19 | AC | 1,362 ms
6,944 KB |
testcase_20 | AC | 2 ms
6,944 KB |
testcase_21 | AC | 2 ms
6,944 KB |
testcase_22 | AC | 2 ms
6,940 KB |
testcase_23 | AC | 1 ms
6,944 KB |
testcase_24 | AC | 2 ms
6,940 KB |
testcase_25 | AC | 2 ms
6,944 KB |
testcase_26 | AC | 2 ms
6,944 KB |
testcase_27 | AC | 1 ms
6,944 KB |
testcase_28 | AC | 2 ms
6,940 KB |
testcase_29 | AC | 2 ms
6,940 KB |
testcase_30 | AC | 1,363 ms
6,940 KB |
testcase_31 | AC | 1,338 ms
6,940 KB |
testcase_32 | AC | 1,358 ms
6,940 KB |
testcase_33 | AC | 1,369 ms
6,944 KB |
testcase_34 | AC | 1,361 ms
6,940 KB |
testcase_35 | AC | 1,381 ms
6,944 KB |
testcase_36 | AC | 1,381 ms
6,940 KB |
testcase_37 | AC | 1,371 ms
6,940 KB |
testcase_38 | AC | 1,348 ms
6,944 KB |
testcase_39 | AC | 1,352 ms
6,940 KB |
testcase_40 | AC | 1,374 ms
6,944 KB |
testcase_41 | AC | 1,361 ms
6,944 KB |
testcase_42 | AC | 1,363 ms
6,940 KB |
testcase_43 | AC | 1,368 ms
6,948 KB |
testcase_44 | AC | 1,356 ms
6,944 KB |
testcase_45 | AC | 1,380 ms
6,940 KB |
testcase_46 | AC | 1,379 ms
6,940 KB |
testcase_47 | AC | 1,356 ms
6,940 KB |
testcase_48 | AC | 1,357 ms
6,944 KB |
testcase_49 | AC | 1,376 ms
6,940 KB |
testcase_50 | AC | 5 ms
6,944 KB |
testcase_51 | AC | 4 ms
6,940 KB |
testcase_52 | AC | 5 ms
6,944 KB |
testcase_53 | AC | 7 ms
6,944 KB |
testcase_54 | AC | 9 ms
6,940 KB |
testcase_55 | AC | 5 ms
6,944 KB |
testcase_56 | AC | 6 ms
6,944 KB |
testcase_57 | AC | 7 ms
6,940 KB |
testcase_58 | AC | 6 ms
6,944 KB |
testcase_59 | AC | 2 ms
6,944 KB |
testcase_60 | AC | 1,391 ms
6,940 KB |
testcase_61 | AC | 1,365 ms
6,944 KB |
testcase_62 | AC | 1,391 ms
6,944 KB |
testcase_63 | AC | 1,367 ms
6,940 KB |
testcase_64 | AC | 1,368 ms
6,940 KB |
testcase_65 | AC | 1,410 ms
6,944 KB |
testcase_66 | AC | 1,373 ms
6,944 KB |
testcase_67 | AC | 1,482 ms
6,940 KB |
testcase_68 | AC | 1,391 ms
6,940 KB |
testcase_69 | AC | 1,379 ms
6,944 KB |
testcase_70 | AC | 1,382 ms
6,940 KB |
testcase_71 | AC | 1,385 ms
6,940 KB |
testcase_72 | AC | 1,384 ms
6,940 KB |
testcase_73 | AC | 1,349 ms
6,944 KB |
testcase_74 | AC | 1,382 ms
6,940 KB |
testcase_75 | AC | 1,368 ms
6,940 KB |
testcase_76 | AC | 1,366 ms
6,944 KB |
testcase_77 | AC | 1,367 ms
6,944 KB |
testcase_78 | AC | 1,358 ms
6,944 KB |
testcase_79 | AC | 1,343 ms
6,940 KB |
testcase_80 | AC | 1,346 ms
6,944 KB |
testcase_81 | AC | 1,350 ms
6,940 KB |
testcase_82 | AC | 2 ms
6,940 KB |
testcase_83 | AC | 2 ms
6,944 KB |
ソースコード
#include<iostream> #include <iomanip> #include <vector> #include <algorithm> #include <string> #include <string.h> #include <climits> #include <cmath> #include <map> #include <set> #include <bitset> #include <stack> #include <queue> #include <fstream> #include <functional> using namespace std; using ll = long long; // graph const ll MAX_V = 1; const ll MAX_E = 1; struct edge { ll from, to, cost; }; edge ES[MAX_E]; vector<edge> G[MAX_V]; ll d[MAX_V]; ll prev_path[MAX_V]; ll V, E; const ll MOD = (ll) 1e9 + 7; const int MAX_INT = 1 << 17; vector<bool> prime; #define all(x) (x).begin(),(x).end() #define PRI(n) cout << n <<endl; #define PRI2(n, m) cout << n << " " << m << " "<<endl; #define REP(i, n) for(int i = 0; i < (ll)n; ++i) #define REPbit(bit, n) for(int bit = 0; bit < (int)(1<<n); ++bit) #define FOR(i, t, n) for(ll i = t; i <= (ll)n; ++i) void Era(int x) { prime.resize(x + 1, 1); prime[0] = 0; prime[1] = 0; FOR(i, 2, sqrt(x)) { if (prime[i]) { for (int j = 2 * i; j <= x; j += i) { prime[j] = 0; } } } } bool isPrime(ll x) { if (x == 0)return 0; if (x == 1)return 0; if (x == 2)return 1; if (x % 2 == 0)return 0; FOR(i, 3, sqrt(x) + 1) { if (x % i == 0)return 0; } return 1; } ll GCD(ll a, ll b) { if (b == 0)return a; return GCD(b, a % b); } ll LCM(ll a, ll b) { ll gcd = GCD(a, b); return a / gcd * b; } ll nCr(ll n, ll r) { vector<ll> C(r + 1); C[0] = 1; FOR(i, 1, n) for (ll j = min(i, r); j < 1; --j) C[j] = (C[j] + C[j - 1]); return C[r]; } template<class T> class SegTree { int n; vector<T> data; T def; function<T(T, T)> operation; function<T(T, T)> update; T _query(int a, int b, int k, int l, int r) { if (r <= a || b <= l) return def; if (a <= l && r <= b) return data[k]; else { T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2); T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r); return operation(c1, c2); } } public: SegTree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update) : def(_def), operation(_operation), update(_update) { n = 1; while (n < _n) { n *= 2; } data = vector<T>(2 * n - 1, def); } void change(int i, T x) { i += n - 1; data[i] = update(data[i], x); while (i > 0) { i = (i - 1) / 2; data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]); } } T query(int a, int b) { return _query(a, b, 0, 0, n); } T operator[](int i) { return data[i + n - 1]; } }; struct UnionFind { vector<int> par; vector<int> rank; UnionFind(int N) { for (int i = 0; i < N; ++i) { par.push_back(i); rank.push_back(0); } } int find(int x) { if (par[x] == x)return x; else return par[x] = find(par[x]); } void unite(int x, int y) { x = find(x); y = find(y); if (x == y)return; if (rank[x] < rank[y])par[x] = y; else { par[y] = x; if (rank[x] == rank[y])rank[x]++; } } bool same(int x, int y) { return find(x) == find(y); } }; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; void Bellman_short(int s) { REP(i, V)d[i] = 1LL << 50; d[s] = 0; REP(i, V)REP(i, E) { edge e = ES[i]; if (d[e.from] != 1LL << 50 && d[e.to] > d[e.from] + e.cost) { d[e.to] = d[e.from] + e.cost; } } } bool Bellman_negLoop(int s) { REP(i, V)d[i] = 1LL << 50; d[s] = 0; REP(i, V)REP(j, E) { edge e = ES[j]; if (d[e.from] != 1LL << 50 && d[e.to] > d[e.from] + e.cost) { d[e.to] = d[e.from] + e.cost; if (i == V - 1)return true; } } return false; } void dijkstra(int s) { typedef pair<ll, ll> P; priority_queue<P, vector<P>, greater<P>> Q; fill(d, d + V, LLONG_MAX); fill(prev_path, prev_path + V, -1); d[s] = 0; Q.push(P(0, s)); while (!Q.empty()) { P p = Q.top(); Q.pop(); ll v = p.second; if (d[v] < p.first)continue; for (edge e:G[v]) { if (d[e.to] > d[v] + e.cost) { d[e.to] = d[v] + e.cost; Q.push(P(d[e.to], e.to)); prev_path[e.to] = v; } } } } vector<ll> getPath(int t) { vector<ll> path; for (; t != -1; t = prev_path[t]) { path.push_back(t); } reverse(all(path)); return path; } // //int A[100001]; // //bool dfs(ll x, int a) { // A[x] = a; // for (edge e : G[x]) { // if (e.cost % 2 == 0) { // if (A[e.to] == -a)return false; // if (A[e.to] == 0 && !dfs(e.to, a))return false; // } else { // if (A[e.to] == a)return false; // if (A[e.to] == 0 && !dfs(e.to, -a))return false; // } // } // return true; //} ll N; int Y[1000000]; int main() { cin >> N; FOR(i, 1, 2e9) { if (N * 2 == i * i + i) { PRI("YES") PRI(i) return 0; } } PRI("NO") return 0; }