QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#640503 | #6262. Jazz it Up! | BaBamBa# | AC ✓ | 5ms | 3976kb | C++17 | 899b | 2024-10-14 13:44:56 | 2024-10-14 13:44:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll N;
cin >> N;
vector<ll> prime;
for (int i = 2; i <= N; i++)
{
bool check = 0;
for (int j = 2; j * j <= i; j++)
{
if (i % j == 0)
{
check = 1;
break;
}
}
if (check == 0)
prime.push_back(i);
}
set<ll> fac;
for (int i = 2; i * i <= N; i++)
{
while (N % i == 0)
{
fac.insert(i);
fac.insert(N / i);
N /= i;
}
}
fac.insert(N);
for (auto &x : prime)
{
if (fac.find(x) == fac.end())
{
cout << x;
break;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
3
output:
2
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
30
output:
7
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
13
output:
2
result:
ok correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
11
output:
2
result:
ok correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
13
output:
2
result:
ok correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
14
output:
3
result:
ok correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
3
output:
2
result:
ok correct
Test #8:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
30030
output:
17
result:
ok correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
5
output:
2
result:
ok correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
6
output:
5
result:
ok correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
7
output:
2
result:
ok correct
Test #12:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
8633
output:
2
result:
ok correct
Test #13:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
89
output:
2
result:
ok correct
Test #14:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
9026
output:
3
result:
ok correct
Test #15:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
9217
output:
2
result:
ok correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
9410
output:
3
result:
ok correct
Test #17:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
9605
output:
2
result:
ok correct
Test #18:
score: 0
Accepted
time: 5ms
memory: 3964kb
input:
99929
output:
2
result:
ok correct
Test #19:
score: 0
Accepted
time: 2ms
memory: 3736kb
input:
99961
output:
2
result:
ok correct
Test #20:
score: 0
Accepted
time: 5ms
memory: 3736kb
input:
99971
output:
2
result:
ok correct
Test #21:
score: 0
Accepted
time: 5ms
memory: 3676kb
input:
99989
output:
2
result:
ok correct
Test #22:
score: 0
Accepted
time: 5ms
memory: 3728kb
input:
99991
output:
2
result:
ok correct
Test #23:
score: 0
Accepted
time: 5ms
memory: 3976kb
input:
96331
output:
2
result:
ok correct
Test #24:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
24213
output:
2
result:
ok correct
Test #25:
score: 0
Accepted
time: 2ms
memory: 3748kb
input:
52259
output:
2
result:
ok correct
Test #26:
score: 0
Accepted
time: 5ms
memory: 3964kb
input:
99123
output:
2
result:
ok correct
Test #27:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
43498
output:
3
result:
ok correct
Test #28:
score: 0
Accepted
time: 5ms
memory: 3672kb
input:
97589
output:
2
result:
ok correct
Test #29:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
30030
output:
17
result:
ok correct
Test #30:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
11663
output:
2
result:
ok correct
Test #31:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
14351
output:
2
result:
ok correct
Test #32:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
17947
output:
2
result:
ok correct
Test #33:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
20711
output:
2
result:
ok correct
Test #34:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
23707
output:
2
result:
ok correct
Test #35:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
27221
output:
2
result:
ok correct
Test #36:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
30967
output:
2
result:
ok correct
Test #37:
score: 0
Accepted
time: 2ms
memory: 3868kb
input:
34571
output:
2
result:
ok correct
Test #38:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
38021
output:
2
result:
ok correct
Test #39:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
199
output:
2
result:
ok correct
Test #40:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
7429
output:
2
result:
ok correct
Test #41:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
33263
output:
2
result:
ok correct
Test #42:
score: 0
Accepted
time: 4ms
memory: 3968kb
input:
82861
output:
2
result:
ok correct
Test #43:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
3127
output:
2
result:
ok correct
Test #44:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
4087
output:
2
result:
ok correct
Test #45:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5183
output:
2
result:
ok correct
Test #46:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
6557
output:
2
result:
ok correct
Test #47:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
8633
output:
2
result:
ok correct
Test #48:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
10403
output:
2
result:
ok correct
Test #49:
score: 0
Accepted
time: 4ms
memory: 3624kb
input:
85263
output:
2
result:
ok correct
Test #50:
score: 0
Accepted
time: 4ms
memory: 3972kb
input:
84101
output:
2
result:
ok correct