QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#362643 | #8508. DiviDuelo | ucup-team3113# | WA | 7ms | 11160kb | C++20 | 860b | 2024-03-23 16:28:37 | 2024-03-23 16:28:38 |
Judging History
answer
#include <bits/stdc++.h>
#define pb push_back
#define int int64_t
#define pii pair<int, int>
#define X first
#define Y second
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound
using namespace std;
const int inf = 1e18;
void p(auto A){
for(auto e : A)cout << e << ' ';
cout << '\n';
}
void solve(){
int n; cin >> n;
vector<int>is_prime((int)1e6+5);
for(int i = 2; i*i< is_prime.size(); i++)if(!is_prime[i]){
for(int j = i*i; j< is_prime.size(); j+= i)is_prime[j] = 1;
}
for(int i = 1; i*i<= n; i++){
if(i*i == n && !(is_prime[i])){
cout << 'N';
return;
}
}
cout << 'Y';
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
//cin >> t;
while(t--)solve();
}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 7ms
memory: 11020kb
input:
10
output:
Y
result:
ok "Y"
Test #2:
score: 0
Accepted
time: 3ms
memory: 11084kb
input:
9
output:
N
result:
ok "N"
Test #3:
score: 0
Accepted
time: 3ms
memory: 10852kb
input:
1
output:
N
result:
ok "N"
Test #4:
score: 0
Accepted
time: 6ms
memory: 11036kb
input:
549755813888
output:
Y
result:
ok "Y"
Test #5:
score: -100
Wrong Answer
time: 3ms
memory: 11160kb
input:
274877906944
output:
Y
result:
wrong answer 1st words differ - expected: 'N', found: 'Y'