QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#382081 | #8508. DiviDuelo | kevinshan# | RE | 0ms | 0kb | C++17 | 1.7kb | 2024-04-08 02:04:39 | 2024-04-08 02:04:41 |
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define For(i,a) FOR(i,0,a)
#define trav(a,b) for(auto& a:b)
#define ins insert
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define lb lower_bound
#define bk back()
#define sz(x) (int) x.size()
#define vpi vector<pi>
const int MX = 1e6+5;
bool is_pr[MX];
void solve() {
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
if (fopen("input.in", "r")) {
freopen("input.in", "r", stdin);
freopen("output.out", "w", stdout);
}
For(i,MX) is_pr[i] = true;
ll n;
cin>>n;
if(n==1) {
cout << 'N' << endl;
return 0;
}
// cout << "N: " << n << endl;
vpi v;
FOR(i,2,MX+1) if(is_pr[i]) {
for(int p=2*i;p<MX;p+=i)
is_pr[p]=false;
int cnt=0;
while(n%i==0) {
n/=i;
cnt++;
}
if(cnt) {
// cout << "A" << i << " " << cnt << endl;
v.pb({i,cnt});
}
}
if(n>1) {
v.pb({n,1});
}
if(sz(v)>=3) {
cout << 'N' << endl;
} else if(sz(v)==2) {
if(v[0].s==1 && v[1].s==1) {
cout << 'Y' << endl;
} else {
cout << 'N' << endl;
}
} else {
assert(sz(v)==1);
if(v[0].s%2==1) {
cout << 'Y' << endl;
} else {
cout << 'N' << endl;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
10