QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#362734#8508. DiviDueloucup-team3113#RE 6ms11200kbC++201.2kb2024-03-23 16:56:042024-03-23 16:56:05

Judging History

你现在查看的是最新测评结果

  • [2024-03-23 16:56:05]
  • 评测
  • 测评结果:RE
  • 用时:6ms
  • 内存:11200kb
  • [2024-03-23 16:56:04]
  • 提交

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<= 100; i++)if(!is_prime[i])cout << i << ' ';
	
	if(n == 1){
		cout << 'N';
			return;
	}
	
	int fl = 0;
	for(int i = 2; i*i<= n; i++)if(n%i==0){
		fl = 1;
		break;
	}
	if(!fl){
		cout << 'Y';
			return;
	}
	for(int i = 2; i*i<= n; i++)if(n%i==0 && is_prime[i] && is_prime[n/i]){
		cout << 'Y';
			return;
	}
	for(int i = 1; i*i<= n; i++){
		if(i*i == n){
			//cout << !(is_prime[i]) << ' ' << (i*i == n && !(is_prime[i])) << endl;
			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: 6ms
memory: 11044kb

input:

10

output:

Y

result:

ok "Y"

Test #2:

score: 0
Accepted
time: 6ms
memory: 10908kb

input:

9

output:

N

result:

ok "N"

Test #3:

score: 0
Accepted
time: 5ms
memory: 11200kb

input:

1

output:

N

result:

ok "N"

Test #4:

score: -100
Runtime Error

input:

549755813888

output:


result: