QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#363741 | #8508. DiviDuelo | ucup-team2000# | WA | 1ms | 3816kb | C++20 | 1.1kb | 2024-03-24 02:37:41 | 2024-03-24 02:37:42 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define f first
#define s second
#define lep(i,a,b) for (int i=(a); i <= (b); i++)
#define rep(i,b,a) for (int i = (b); i >= (a); i--)
map<int,int> factorize(int n) {
map<int,int> res;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
while (n % i == 0) {
n /= i;
res[i]++;
}
}
}
if (n > 1) res[n]++;
return res;
}
void yay() {
cout << "Y\n";
}
void gg() {
cout << "N\n";
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
map<int,int> res = factorize(n);
if ((int)res.size() == 1 and res.begin()->s == 1) {
yay();
} else if ((int)res.size() == 2) {
bool ok = true;
for (pi p: res) {
if (p.s > 1) ok = false;
}
if (ok) {
yay();
} else {
gg();
}
} else {
gg();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3812kb
input:
10
output:
Y
result:
ok "Y"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
9
output:
N
result:
ok "N"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
1
output:
N
result:
ok "N"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3584kb
input:
549755813888
output:
N
result:
wrong answer 1st words differ - expected: 'Y', found: 'N'