QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#500584 | #3825. Johnny-Bohr model | PetroTarnavskyi# | TL | 3ms | 3968kb | C++20 | 757b | 2024-08-01 15:33:42 | 2024-08-01 15:33:42 |
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;
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;
rec(n, b);
cout << SZ(used) << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3532kb
input:
20 2 2 3
output:
8
result:
ok 1 number(s): "8"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
445324002114855 5 50 18 11 29 50
output:
770
result:
ok 1 number(s): "770"
Test #3:
score: 0
Accepted
time: 3ms
memory: 3968kb
input:
849689440045613 6 2 45 1 3 37 48
output:
4801
result:
ok 1 number(s): "4801"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
972271750539970 3 47 48 38
output:
169
result:
ok 1 number(s): "169"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
630141090045023 6 32 29 32 49 32 5
output:
967
result:
ok 1 number(s): "967"
Test #6:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
977306387802331 3 424473418351672 846719471067011 64692564538542
output:
5
result:
ok 1 number(s): "5"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
532111166311786 2 750599096849808 23131064871231
output:
3
result:
ok 1 number(s): "3"
Test #8:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
802543897816743 5 18571703958581 455173142691042 59823594575991 660365562242765 948770799861896
output:
5
result:
ok 1 number(s): "5"
Test #9:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
175873121784708 10 239121950367512 596663687845171 947183392515786 841019380580441 534735471105678 311910885371862 881871548002536 645337539543118 203337780181784 277120439948970
output:
2
result:
ok 1 number(s): "2"
Test #10:
score: -100
Time Limit Exceeded
input:
603339140034734 10 2 3 5 7 11 13 17 19 23 29