QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#500585 | #3825. Johnny-Bohr model | PetroTarnavskyi# | AC ✓ | 167ms | 25960kb | C++20 | 840b | 2024-08-01 15:36:21 | 2024-08-01 15:36:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
unordered_set<LL> used;
void rec(LL n, const vector<LL>& b)
{
if (used.count(n))
return;
used.insert(n);
for (LL bi : b)
rec(n / bi, b);
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
LL n;
int m;
cin >> n >> m;
vector<LL> b(m);
for (LL& bi : b)
cin >> bi;
used.reserve(1000000);
rec(n, b);
cout << SZ(used) << "\n";
cerr << (db)clock() / CLOCKS_PER_SEC << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 11284kb
input:
20 2 2 3
output:
8
result:
ok 1 number(s): "8"
Test #2:
score: 0
Accepted
time: 4ms
memory: 11452kb
input:
445324002114855 5 50 18 11 29 50
output:
770
result:
ok 1 number(s): "770"
Test #3:
score: 0
Accepted
time: 0ms
memory: 11532kb
input:
849689440045613 6 2 45 1 3 37 48
output:
4801
result:
ok 1 number(s): "4801"
Test #4:
score: 0
Accepted
time: 0ms
memory: 11268kb
input:
972271750539970 3 47 48 38
output:
169
result:
ok 1 number(s): "169"
Test #5:
score: 0
Accepted
time: 2ms
memory: 11288kb
input:
630141090045023 6 32 29 32 49 32 5
output:
967
result:
ok 1 number(s): "967"
Test #6:
score: 0
Accepted
time: 0ms
memory: 11288kb
input:
977306387802331 3 424473418351672 846719471067011 64692564538542
output:
5
result:
ok 1 number(s): "5"
Test #7:
score: 0
Accepted
time: 0ms
memory: 11268kb
input:
532111166311786 2 750599096849808 23131064871231
output:
3
result:
ok 1 number(s): "3"
Test #8:
score: 0
Accepted
time: 0ms
memory: 11272kb
input:
802543897816743 5 18571703958581 455173142691042 59823594575991 660365562242765 948770799861896
output:
5
result:
ok 1 number(s): "5"
Test #9:
score: 0
Accepted
time: 4ms
memory: 11292kb
input:
175873121784708 10 239121950367512 596663687845171 947183392515786 841019380580441 534735471105678 311910885371862 881871548002536 645337539543118 203337780181784 277120439948970
output:
2
result:
ok 1 number(s): "2"
Test #10:
score: 0
Accepted
time: 149ms
memory: 24148kb
input:
603339140034734 10 2 3 5 7 11 13 17 19 23 29
output:
406740
result:
ok 1 number(s): "406740"
Test #11:
score: 0
Accepted
time: 4ms
memory: 11600kb
input:
66040484799879 5 631951793259615 965305817861578 684660900800103 391037877291270 197053426793821
output:
2
result:
ok 1 number(s): "2"
Test #12:
score: 0
Accepted
time: 2ms
memory: 11480kb
input:
826727574095505 8 63314417081892 971910373897934 957102910740413 790706593077956 545303010503432 214051389655964 545446594307043 789569790420408
output:
5
result:
ok 1 number(s): "5"
Test #13:
score: 0
Accepted
time: 4ms
memory: 11300kb
input:
937949016891440 2 573811764233203 260090400630284
output:
4
result:
ok 1 number(s): "4"
Test #14:
score: 0
Accepted
time: 0ms
memory: 11288kb
input:
672968903786423 2 706775533344794 976686193397296
output:
2
result:
ok 1 number(s): "2"
Test #15:
score: 0
Accepted
time: 0ms
memory: 11452kb
input:
894529448529143 6 229982008678797 306025861223782 228298088322855 497034869329886 609536567796004 643835285372523
output:
5
result:
ok 1 number(s): "5"
Test #16:
score: 0
Accepted
time: 0ms
memory: 11292kb
input:
101259710597743 4 976631409484974 283087402161674 474892710972626 47544505334617
output:
3
result:
ok 1 number(s): "3"
Test #17:
score: 0
Accepted
time: 0ms
memory: 11604kb
input:
276135548465382 6 282028331830167 68827371321476 875597427197575 386020333914814 599258545395295 90016356212845
output:
4
result:
ok 1 number(s): "4"
Test #18:
score: 0
Accepted
time: 0ms
memory: 11336kb
input:
942157799725639 8 585019935451641 150223788576816 5240174360539 364429628337764 450764676474054 147273760035689 584925692551093 613462640090054
output:
6
result:
ok 1 number(s): "6"
Test #19:
score: 0
Accepted
time: 4ms
memory: 11412kb
input:
826085243068143 1 981203117059481
output:
2
result:
ok 1 number(s): "2"
Test #20:
score: 0
Accepted
time: 4ms
memory: 11452kb
input:
157786573931208 7 110167228142052 415847633813843 858446303635312 891106446339243 8618007339534 203992898934295 455325020803021
output:
4
result:
ok 1 number(s): "4"
Test #21:
score: 0
Accepted
time: 0ms
memory: 11304kb
input:
663019530512686 8 5394433086286 74049489275440 947591843604856 204781219833624 223297966303309 134977985824999 113665486121472 974656050535708
output:
8
result:
ok 1 number(s): "8"
Test #22:
score: 0
Accepted
time: 0ms
memory: 11288kb
input:
502664533086574 10 979077099626101 384358126912610 164158188800928 741704418486158 437408680979180 676390789849042 356862893391807 396978668703949 589823303747658 321828551698393
output:
4
result:
ok 1 number(s): "4"
Test #23:
score: 0
Accepted
time: 0ms
memory: 11480kb
input:
395617719528945 6 617937379240823 832023590661081 936960219367345 712354898262114 959152123961691 430110617460155
output:
2
result:
ok 1 number(s): "2"
Test #24:
score: 0
Accepted
time: 2ms
memory: 11352kb
input:
609497725282873 1 753386351344904
output:
2
result:
ok 1 number(s): "2"
Test #25:
score: 0
Accepted
time: 2ms
memory: 11284kb
input:
869811956002377 7 813965041412506 707477956233371 665580188070462 621785521580902 407067588087202 165897057799920 226215200089036
output:
6
result:
ok 1 number(s): "6"
Test #26:
score: 0
Accepted
time: 0ms
memory: 11348kb
input:
121438149273280 1 711361241697739
output:
2
result:
ok 1 number(s): "2"
Test #27:
score: 0
Accepted
time: 0ms
memory: 11300kb
input:
65528782914303 8 712389599906393 487547750731 623489147562381 41237368548630 197537485764945 695781508550433 818177256814946 756715581433930
output:
4
result:
ok 1 number(s): "4"
Test #28:
score: 0
Accepted
time: 0ms
memory: 11448kb
input:
356177373715601 10 999196378447321 597030352264496 48400119656905 132189906289790 771515916357481 223938935972687 145663323722208 980514885311854 901621361994336 554633001874122
output:
5
result:
ok 1 number(s): "5"
Test #29:
score: 0
Accepted
time: 0ms
memory: 11416kb
input:
858542274199496 1 226535806209053
output:
3
result:
ok 1 number(s): "3"
Test #30:
score: 0
Accepted
time: 0ms
memory: 11344kb
input:
160033648422617 8 60593767295367 808032993643783 8191093997876 269871229023601 59245467465793 149895381159670 651561973500242 404867269384744
output:
5
result:
ok 1 number(s): "5"
Test #31:
score: 0
Accepted
time: 0ms
memory: 11292kb
input:
814604515009679 1 250873414619899
output:
3
result:
ok 1 number(s): "3"
Test #32:
score: 0
Accepted
time: 2ms
memory: 11452kb
input:
142169229756838 2 122769072123740 8771946363770
output:
4
result:
ok 1 number(s): "4"
Test #33:
score: 0
Accepted
time: 4ms
memory: 11408kb
input:
731883942604522 6 204946409374779 20223409728380 631796043523864 30091449572301 93409029488643 458301834549867
output:
7
result:
ok 1 number(s): "7"
Test #34:
score: 0
Accepted
time: 3ms
memory: 11676kb
input:
978899263822422 3 454999020176020 395714402603158 638994638687901
output:
4
result:
ok 1 number(s): "4"
Test #35:
score: 0
Accepted
time: 3ms
memory: 11236kb
input:
467555069049435 1 292482077612384
output:
3
result:
ok 1 number(s): "3"
Test #36:
score: 0
Accepted
time: 3ms
memory: 11288kb
input:
588321466991323 10 62906617407312 195197763499578 2180098702512 251266794845553 963912485104348 937688974126830 574018859441526 156943553268878 713469313102064 237536142820913
output:
7
result:
ok 1 number(s): "7"
Test #37:
score: 0
Accepted
time: 3ms
memory: 11340kb
input:
162881580122834 6 177481392875718 361463444953303 799175800353802 724098895463363 528527782182732 599610272692076
output:
2
result:
ok 1 number(s): "2"
Test #38:
score: 0
Accepted
time: 3ms
memory: 11356kb
input:
512545272312541 4 862769802404416 647600980832852 834478204649958 39263999744350
output:
3
result:
ok 1 number(s): "3"
Test #39:
score: 0
Accepted
time: 0ms
memory: 11348kb
input:
683753672602150 6 187249497972478 105071656874543 615268362579729 12713265772096 40057032809584 331628180710424
output:
8
result:
ok 1 number(s): "8"
Test #40:
score: 0
Accepted
time: 0ms
memory: 11264kb
input:
507055019351411 2 796861217176116 898334171175964
output:
2
result:
ok 1 number(s): "2"
Test #41:
score: 0
Accepted
time: 0ms
memory: 11280kb
input:
905687499731634 3 895242391705613 24358622285141 6842217043430
output:
5
result:
ok 1 number(s): "5"
Test #42:
score: 0
Accepted
time: 0ms
memory: 11276kb
input:
322567966970272 2 706743582082035 975106019769649
output:
2
result:
ok 1 number(s): "2"
Test #43:
score: 0
Accepted
time: 0ms
memory: 11472kb
input:
227013219953333 1 854641207631726
output:
2
result:
ok 1 number(s): "2"
Test #44:
score: 0
Accepted
time: 4ms
memory: 11272kb
input:
54488993804529 3 157886209011380 312960455706391 267729583280536
output:
2
result:
ok 1 number(s): "2"
Test #45:
score: 0
Accepted
time: 2ms
memory: 11256kb
input:
707565587040536 6 290772798884949 162291272414452 886164233567770 715594261706411 904154838238548 927431578238642
output:
4
result:
ok 1 number(s): "4"
Test #46:
score: 0
Accepted
time: 0ms
memory: 11236kb
input:
893666641498448 1 441270491460814
output:
3
result:
ok 1 number(s): "3"
Test #47:
score: 0
Accepted
time: 2ms
memory: 11472kb
input:
415392260439746 8 152490134853422 959907181655243 602100613711522 82892093198960 979005092999987 4256508319567 128243422940846 857428546792172
output:
6
result:
ok 1 number(s): "6"
Test #48:
score: 0
Accepted
time: 0ms
memory: 11412kb
input:
903092757458365 6 972107771824729 701214440508295 749071019202095 970898721940332 893229071903235 497482781470289
output:
3
result:
ok 1 number(s): "3"
Test #49:
score: 0
Accepted
time: 0ms
memory: 11420kb
input:
212888096195245 9 31326553119497 279084544987022 664721989686164 931392702399177 790040988333470 802575363613351 238332186843302 841514562749552 796310627987637
output:
3
result:
ok 1 number(s): "3"
Test #50:
score: 0
Accepted
time: 4ms
memory: 11268kb
input:
69814659473069 1 131541149040012
output:
2
result:
ok 1 number(s): "2"
Test #51:
score: 0
Accepted
time: 0ms
memory: 11276kb
input:
545307925569762 5 752118884257660 599155066388317 336636147389648 131032330773199 135058327315376
output:
4
result:
ok 1 number(s): "4"
Test #52:
score: 0
Accepted
time: 0ms
memory: 11300kb
input:
378089995627526 1 514550161066948
output:
2
result:
ok 1 number(s): "2"
Test #53:
score: 0
Accepted
time: 0ms
memory: 11448kb
input:
938951092693098 5 47082023064176 581706209230533 614864195851340 50527844823345 870781117384705
output:
5
result:
ok 1 number(s): "5"
Test #54:
score: 0
Accepted
time: 0ms
memory: 11356kb
input:
329960145824147 10 661929398946638 407906250628541 985432692256326 809310404157029 79094150834768 631627800345128 472836952486940 181093854197880 261963827325397 390192987222450
output:
4
result:
ok 1 number(s): "4"
Test #55:
score: 0
Accepted
time: 0ms
memory: 11268kb
input:
714864566143084 2 534958334101335 110483133935508
output:
4
result:
ok 1 number(s): "4"
Test #56:
score: 0
Accepted
time: 4ms
memory: 11292kb
input:
523617956300653 7 390574535626405 244864949766341 939281525443142 25236455817343 626446636849549 129252143998024 766271670782150
output:
6
result:
ok 1 number(s): "6"
Test #57:
score: 0
Accepted
time: 4ms
memory: 11284kb
input:
542908935282959 7 919919863605866 758799626906772 371493069020186 438181665350738 184075633428655 168917772570990 780515001953740
output:
5
result:
ok 1 number(s): "5"
Test #58:
score: 0
Accepted
time: 4ms
memory: 11272kb
input:
928873991926012 2 694877686874157 234228075029931
output:
4
result:
ok 1 number(s): "4"
Test #59:
score: 0
Accepted
time: 4ms
memory: 11352kb
input:
82296247568787 8 900740451677103 854477305932436 599347556731932 474460449618097 647900573724008 490334942707589 397436493398616 979509840465252
output:
2
result:
ok 1 number(s): "2"
Test #60:
score: 0
Accepted
time: 0ms
memory: 11280kb
input:
332861633811577 9 911069671740641 274112419168565 336421529039007 465937383135016 192638855213120 228335098589756 613410957372652 971253502446634 161784523223825
output:
4
result:
ok 1 number(s): "4"
Test #61:
score: 0
Accepted
time: 0ms
memory: 11272kb
input:
710168011942808 9 773733770026759 402289291798860 576897390695714 421997677869999 268207697379670 697113057505103 323451896882920 256339666732029 173444238016680
output:
5
result:
ok 1 number(s): "5"
Test #62:
score: 0
Accepted
time: 2ms
memory: 11480kb
input:
252115294090526 8 313868176478924 384556288148890 473885696103374 931029609321093 112699165864553 452149786753425 441734037452216 414301834272052
output:
3
result:
ok 1 number(s): "3"
Test #63:
score: 0
Accepted
time: 0ms
memory: 11324kb
input:
312416380832131 1 254940060809645
output:
3
result:
ok 1 number(s): "3"
Test #64:
score: 0
Accepted
time: 0ms
memory: 11264kb
input:
822133333978023 10 813314436303784 953234143294130 545550782645998 129905532758457 39531015191759 668287792460473 509868347287130 585112626817697 485849767051754 805802706702324
output:
5
result:
ok 1 number(s): "5"
Test #65:
score: 0
Accepted
time: 4ms
memory: 11264kb
input:
865883664293386 1 567107888760518
output:
3
result:
ok 1 number(s): "3"
Test #66:
score: 0
Accepted
time: 0ms
memory: 11412kb
input:
826940919070126 10 411835542747001 73626538117073 851924695072342 267688396194578 313568286435856 623230244638134 596033597781849 158454760480062 511013626942659 18389008848792
output:
8
result:
ok 1 number(s): "8"
Test #67:
score: 0
Accepted
time: 0ms
memory: 11340kb
input:
762120385198281 5 326143093245157 48509708948377 531202778767946 522011488784642 854696641455408
output:
5
result:
ok 1 number(s): "5"
Test #68:
score: 0
Accepted
time: 4ms
memory: 11408kb
input:
694909364510684 7 471196662816339 114095862820633 539462679202652 161042916448830 258561347432479 608583686099567 885970163538910
output:
6
result:
ok 1 number(s): "6"
Test #69:
score: 0
Accepted
time: 0ms
memory: 11256kb
input:
599575570650536 3 108082128003361 754615603329804 965090621888682
output:
3
result:
ok 1 number(s): "3"
Test #70:
score: 0
Accepted
time: 0ms
memory: 11300kb
input:
861945962402965 1 929989673896389
output:
2
result:
ok 1 number(s): "2"
Test #71:
score: 0
Accepted
time: 0ms
memory: 11264kb
input:
82847317521945 3 580757357944386 654673062504168 772644285194547
output:
2
result:
ok 1 number(s): "2"
Test #72:
score: 0
Accepted
time: 0ms
memory: 11348kb
input:
734460526415023 4 262988248319423 868503304942138 540884853269073 79883820479159
output:
5
result:
ok 1 number(s): "5"
Test #73:
score: 0
Accepted
time: 4ms
memory: 11412kb
input:
948246738412574 6 119920903397929 61701089556637 403253706748386 997242325681937 879593269562237 263424370573131
output:
7
result:
ok 1 number(s): "7"
Test #74:
score: 0
Accepted
time: 0ms
memory: 11408kb
input:
353672733313989 1 985174512775138
output:
2
result:
ok 1 number(s): "2"
Test #75:
score: 0
Accepted
time: 0ms
memory: 11252kb
input:
381945089312666 4 1 2 3 4
output:
655
result:
ok 1 number(s): "655"
Test #76:
score: 0
Accepted
time: 5ms
memory: 11736kb
input:
11988726785107 6 1 2 3 4 5 6
output:
2660
result:
ok 1 number(s): "2660"
Test #77:
score: 0
Accepted
time: 3ms
memory: 11796kb
input:
732844978102908 8 1 2 3 4 5 6 7 8
output:
13935
result:
ok 1 number(s): "13935"
Test #78:
score: 0
Accepted
time: 0ms
memory: 11828kb
input:
470823978684325 10 1 2 3 4 5 6 7 8 9 10
output:
13174
result:
ok 1 number(s): "13174"
Test #79:
score: 0
Accepted
time: 0ms
memory: 11284kb
input:
564975721202982 3 1 2 3
output:
674
result:
ok 1 number(s): "674"
Test #80:
score: 0
Accepted
time: 0ms
memory: 11880kb
input:
587307744657883 10 1 2 3 4 5 6 7 8 9 10
output:
13567
result:
ok 1 number(s): "13567"
Test #81:
score: 0
Accepted
time: 0ms
memory: 11224kb
input:
955696222353438 4 1 2 3 4
output:
697
result:
ok 1 number(s): "697"
Test #82:
score: 0
Accepted
time: 0ms
memory: 11272kb
input:
5463925839389 3 1 2 3
output:
496
result:
ok 1 number(s): "496"
Test #83:
score: 0
Accepted
time: 3ms
memory: 11868kb
input:
669880763736268 10 1 2 3 4 5 6 7 8 9 10
output:
13804
result:
ok 1 number(s): "13804"
Test #84:
score: 0
Accepted
time: 2ms
memory: 11556kb
input:
726404825412142 6 1 2 3 4 5 6
output:
3978
result:
ok 1 number(s): "3978"
Test #85:
score: 0
Accepted
time: 0ms
memory: 11476kb
input:
166440904263770 2 1 2
output:
49
result:
ok 1 number(s): "49"
Test #86:
score: 0
Accepted
time: 0ms
memory: 11452kb
input:
872548592644364 3 1 2 3
output:
690
result:
ok 1 number(s): "690"
Test #87:
score: 0
Accepted
time: 2ms
memory: 11524kb
input:
29296613650169 7 1 2 3 4 5 6 7
output:
9251
result:
ok 1 number(s): "9251"
Test #88:
score: 0
Accepted
time: 4ms
memory: 11284kb
input:
443517138069357 3 1 2 3
output:
659
result:
ok 1 number(s): "659"
Test #89:
score: 0
Accepted
time: 139ms
memory: 24212kb
input:
622259808828767 10 2 3 5 7 11 13 17 19 23 29
output:
409847
result:
ok 1 number(s): "409847"
Test #90:
score: 0
Accepted
time: 167ms
memory: 25960kb
input:
1000000000000000 10 2 3 5 7 11 13 17 19 23 29
output:
458123
result:
ok 1 number(s): "458123"