Submission #00005
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #include <bits/stdc++.h> #define F first #define S second #define MP make_pair #define pb push_back #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define LCM(a, b) (a) / __gcd((a), (b)) * (b) #define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0) #define log_2(a) (log((a)) / log(2)) #define ln '\n' using namespace std; using LL = long long ; using ldouble = long double ; using P = pair< int , int >; using LP = pair<LL, LL>; static const int INF = INT_MAX; static const LL LINF = LLONG_MAX; static const int MIN = INT_MIN; static const LL LMIN = LLONG_MIN; static const int MOD = 1e9 + 7; static const int SIZE = 200005; const int dx[] = {0, -1, 1, 0}; const int dy[] = {-1, 0, 0, 1}; vector<LL> Div(LL n) { vector<LL> ret; for (LL i = 1; i * i <= n; ++i) { if (n % i == 0) { ret.pb(i); if (i * i != n) ret.pb(n / i); } } sort(all(ret)); return ret; } int main() { ios::sync_with_stdio( false ); cin.tie(0); LL N; cin >> N; vector<LL> v; for (LL i = 1; i * i <= N; ++i) { v.pb(i * i); } for (LL i = 1; i * i <= N; ++i) { LL b = N - (i * i); auto p = lower_bound(all(v), b); if (p != v.end() && *p == b) { vector<LL> div = Div(b); cout << i << " " << div [ div .size() / 2] << endl; return 0; } } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0001 - さらば2020、ようこそ2021 |
ユーザー名 | crom |
投稿日時 | 2020-12-30 00:07:17 |
言語 | C++14 |
状態 | Accepted |
得点 | 100 |
ソースコード長 | 1459 Byte |
最大実行時間 | 51 ms |
最大メモリ使用量 | 18584 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 100 / 100 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 38 ms | 5452 KB |
1
|
in02.txt | AC | 36 ms | 9372 KB |
1
|
in03.txt | AC | 35 ms | 10136 KB |
1
|
in04.txt | AC | 34 ms | 9032 KB |
1
|
in05.txt | AC | 50 ms | 17436 KB |
1
|
in06.txt | AC | 35 ms | 10636 KB |
1
|
in07.txt | AC | 36 ms | 9336 KB |
1
|
in08.txt | AC | 31 ms | 5104 KB |
1
|
in09.txt | AC | 29 ms | 10004 KB |
1
|
in10.txt | AC | 31 ms | 1572 KB |
1
|
in11.txt | AC | 32 ms | 10140 KB |
1
|
in12.txt | AC | 35 ms | 10156 KB |
1
|
in13.txt | AC | 43 ms | 18248 KB |
1
|
in14.txt | AC | 39 ms | 9024 KB |
1
|
in15.txt | AC | 38 ms | 9196 KB |
1
|
in16.txt | AC | 40 ms | 17272 KB |
1
|
in17.txt | AC | 42 ms | 18464 KB |
1
|
in18.txt | AC | 34 ms | 10948 KB |
1
|
in19.txt | AC | 40 ms | 10892 KB |
1
|
in20.txt | AC | 41 ms | 10692 KB |
1
|
in21.txt | AC | 34 ms | 9488 KB |
1
|
in22.txt | AC | 38 ms | 10048 KB |
1
|
in23.txt | AC | 32 ms | 5692 KB |
1
|
in24.txt | AC | 34 ms | 10380 KB |
1
|
in25.txt | AC | 45 ms | 10332 KB |
1
|
in26.txt | AC | 39 ms | 10688 KB |
1
|
in27.txt | AC | 32 ms | 9232 KB |
1
|
in28.txt | AC | 33 ms | 4744 KB |
1
|
in29.txt | AC | 24 ms | 6080 KB |
1
|
in30.txt | AC | 35 ms | 10572 KB |
1
|
in31.txt | AC | 51 ms | 17540 KB |
1
|
in32.txt | AC | 40 ms | 18584 KB |
1
|
in33.txt | AC | 42 ms | 9528 KB |
1
|
in34.txt | AC | 48 ms | 17316 KB |
1
|
in35.txt | AC | 30 ms | 9708 KB |
1
|
in36.txt | AC | 36 ms | 17604 KB |
1
|
in37.txt | AC | 42 ms | 9508 KB |
1
|
in38.txt | AC | 47 ms | 9752 KB |
1
|
in39.txt | AC | 30 ms | 9772 KB |
1
|
in40.txt | AC | 30 ms | 6064 KB |
1
|
in41.txt | AC | 33 ms | 10620 KB |
1
|
in42.txt | AC | 44 ms | 9884 KB |
1
|
in43.txt | AC | 29 ms | 6324 KB |
1
|
in44.txt | AC | 33 ms | 5484 KB |
1
|
in45.txt | AC | 42 ms | 9940 KB |
1
|
in46.txt | AC | 39 ms | 10204 KB |
1
|
in47.txt | AC | 43 ms | 10544 KB |
1
|
in48.txt | AC | 35 ms | 9068 KB |
1
|
in49.txt | AC | 28 ms | 5052 KB |
1
|
in50.txt | AC | 33 ms | 10540 KB |
1
|
in51.txt | AC | 46 ms | 18228 KB |
1
|
in52.txt | AC | 50 ms | 10720 KB |
1
|
in53.txt | AC | 29 ms | 6336 KB |
1
|
in54.txt | AC | 35 ms | 10448 KB |
1
|
in55.txt | AC | 39 ms | 10920 KB |
1
|
in56.txt | AC | 31 ms | 6172 KB |
1
|
in57.txt | AC | 43 ms | 17852 KB |
1
|
in58.txt | AC | 40 ms | 9056 KB |
1
|
in59.txt | AC | 34 ms | 10876 KB |
1
|
in60.txt | AC | 42 ms | 17272 KB |
1
|
sample01.txt | AC | 20 ms | 596 KB |
1
|
sample02.txt | AC | 22 ms | 684 KB |
1
|