結果
問題 | No.1262 グラフを作ろう! |
ユーザー | fastmath |
提出日時 | 2020-10-16 23:40:51 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,706 bytes |
コンパイル時間 | 2,312 ms |
コンパイル使用メモリ | 202,980 KB |
実行使用メモリ | 131,404 KB |
最終ジャッジ日時 | 2024-07-21 00:33:49 |
合計ジャッジ時間 | 22,436 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,423 ms
126,584 KB |
testcase_01 | AC | 2,271 ms
125,824 KB |
testcase_02 | AC | 2,469 ms
128,384 KB |
testcase_03 | AC | 2,135 ms
124,416 KB |
testcase_04 | AC | 1,953 ms
129,652 KB |
testcase_05 | AC | 2,286 ms
127,604 KB |
testcase_06 | AC | 1,981 ms
131,072 KB |
testcase_07 | AC | 1,976 ms
124,160 KB |
testcase_08 | AC | 2,704 ms
130,048 KB |
testcase_09 | AC | 2,328 ms
123,888 KB |
testcase_10 | AC | 2,274 ms
125,440 KB |
testcase_11 | AC | 2,640 ms
130,816 KB |
testcase_12 | AC | 2,436 ms
126,192 KB |
testcase_13 | AC | 2,341 ms
124,672 KB |
testcase_14 | AC | 2,223 ms
126,044 KB |
testcase_15 | AC | 2,110 ms
123,336 KB |
testcase_16 | AC | 2,520 ms
129,408 KB |
testcase_17 | AC | 2,437 ms
128,000 KB |
testcase_18 | AC | 2,646 ms
129,280 KB |
testcase_19 | AC | 2,038 ms
128,640 KB |
testcase_20 | AC | 2,154 ms
131,404 KB |
testcase_21 | AC | 2,554 ms
128,256 KB |
testcase_22 | AC | 1,892 ms
128,384 KB |
testcase_23 | AC | 2,228 ms
124,544 KB |
testcase_24 | AC | 2,406 ms
129,792 KB |
testcase_25 | AC | 1,987 ms
126,168 KB |
testcase_26 | AC | 2,412 ms
126,848 KB |
testcase_27 | TLE | - |
testcase_28 | AC | 2,200 ms
128,384 KB |
testcase_29 | AC | 2,101 ms
129,408 KB |
testcase_30 | AC | 2,088 ms
126,464 KB |
testcase_31 | AC | 2,416 ms
126,592 KB |
testcase_32 | AC | 2,267 ms
126,592 KB |
testcase_33 | AC | 1,902 ms
123,520 KB |
testcase_34 | AC | 2,361 ms
131,072 KB |
testcase_35 | AC | 2,195 ms
125,312 KB |
testcase_36 | AC | 1,923 ms
123,224 KB |
testcase_37 | AC | 2,602 ms
129,280 KB |
testcase_38 | AC | 2,334 ms
128,616 KB |
testcase_39 | AC | 2,176 ms
124,156 KB |
testcase_40 | AC | 2,214 ms
125,440 KB |
testcase_41 | AC | 2,147 ms
129,920 KB |
testcase_42 | AC | 2,570 ms
129,636 KB |
testcase_43 | AC | 2,210 ms
127,600 KB |
testcase_44 | AC | 2,232 ms
127,196 KB |
testcase_45 | AC | 2,614 ms
130,688 KB |
testcase_46 | AC | 2,109 ms
131,328 KB |
testcase_47 | AC | 2,001 ms
123,264 KB |
testcase_48 | AC | 2,405 ms
129,280 KB |
testcase_49 | AC | 2,529 ms
128,896 KB |
testcase_50 | AC | 2,504 ms
129,152 KB |
testcase_51 | AC | 2,066 ms
123,992 KB |
testcase_52 | AC | 2,166 ms
130,128 KB |
testcase_53 | AC | 2,028 ms
124,492 KB |
testcase_54 | AC | 2,276 ms
125,300 KB |
testcase_55 | AC | 2,289 ms
125,952 KB |
testcase_56 | AC | 2,312 ms
129,124 KB |
testcase_57 | AC | 2,976 ms
130,000 KB |
testcase_58 | AC | 2,275 ms
124,928 KB |
testcase_59 | AC | 2,222 ms
129,536 KB |
testcase_60 | AC | 2,750 ms
129,536 KB |
testcase_61 | AC | 2,152 ms
125,440 KB |
testcase_62 | AC | 2,450 ms
127,744 KB |
testcase_63 | AC | 2,265 ms
124,916 KB |
testcase_64 | AC | 2,445 ms
125,696 KB |
testcase_65 | AC | 2,171 ms
126,304 KB |
testcase_66 | AC | 2,179 ms
125,696 KB |
testcase_67 | AC | 2,046 ms
126,848 KB |
testcase_68 | AC | 2,229 ms
130,816 KB |
testcase_69 | AC | 2,238 ms
126,316 KB |
testcase_70 | AC | 2,622 ms
128,256 KB |
testcase_71 | AC | 2,310 ms
125,292 KB |
testcase_72 | AC | 2,646 ms
127,872 KB |
testcase_73 | AC | 2,302 ms
125,440 KB |
testcase_74 | AC | 1,950 ms
123,136 KB |
testcase_75 | AC | 2,209 ms
125,440 KB |
testcase_76 | AC | 2,158 ms
125,028 KB |
testcase_77 | AC | 2,162 ms
124,288 KB |
testcase_78 | AC | 2,347 ms
125,952 KB |
testcase_79 | AC | 2,580 ms
128,128 KB |
testcase_80 | AC | 2,661 ms
128,384 KB |
testcase_81 | AC | 2,269 ms
124,160 KB |
testcase_82 | TLE | - |
testcase_83 | TLE | - |
testcase_84 | AC | 2,250 ms
125,184 KB |
testcase_85 | AC | 2,767 ms
127,860 KB |
testcase_86 | AC | 2,349 ms
125,404 KB |
testcase_87 | AC | 2,631 ms
126,976 KB |
testcase_88 | AC | 2,189 ms
123,860 KB |
testcase_89 | AC | 2,510 ms
127,360 KB |
testcase_90 | AC | 2,000 ms
122,496 KB |
testcase_91 | AC | 2,083 ms
122,740 KB |
testcase_92 | AC | 2,078 ms
122,608 KB |
testcase_93 | AC | 2,099 ms
122,624 KB |
testcase_94 | AC | 2,059 ms
123,472 KB |
testcase_95 | AC | 2,965 ms
131,328 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; #define ii pair <int, int> #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcountll #define ll long long #define mp make_pair #define f first #define s second #define Time (double)clock()/CLOCKS_PER_SEC #define debug(x) std::cout << #x << ": " << x << '\n'; const int N = 1e6+7; int pw[N]; bool p[N]; vector <int> d[N]; bool used[N]; int me[N]; int cnt[N]; signed main() { #ifdef HOME freopen("input.txt", "r", stdin); #else #define endl '\n' ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20); #endif for (int i = 1; i < N; ++i) for (int j = i; j < N; j += i) d[j].app(i); for (int i = 2; i < N; ++i) p[i] = 1; for (int i = 2; i < N; ++i) { if (p[i]) { pw[i] = 1; for (int j = i * 2; j < N; j += i) { p[j] = 0; pw[j]++; } } } for (int i = 0; i < N; ++i) { reverse(all(d[i])); } int n, m; cin >> n >> m; ll ans = 0; for (int i = 0; i < m; ++i) { int x; cin >> x; if (used[x]) { ans += me[x]; continue; } used[x] = 1; for (int a : d[x]) cnt[a] = 0; for (int a : d[x]) { cnt[a] += x/a; me[x] += cnt[a] * ((x - 1) % a); for (int b : d[a]) if (b < a) cnt[b] -= cnt[a]; } ans += me[x]; } cout << ans << endl; #ifdef HOME cout << Time << endl; #endif }