QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#362694#8508. DiviDueloucup-team3113#WA 7ms11196kbC++201.2kb2024-03-23 16:45:012024-03-23 16:45:01

Judging History

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

  • [2024-03-23 16:45:01]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:11196kb
  • [2024-03-23 16:45:01]
  • 提交

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 << 'N';
			return;
	}
	for(int i = 1; i*i<= n; i++){
		if(i*i == n && !(is_prime[i])){
			//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: 7ms
memory: 11176kb

input:

10

output:

Y

result:

ok "Y"

Test #2:

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

input:

9

output:

N

result:

ok "N"

Test #3:

score: 0
Accepted
time: 3ms
memory: 11196kb

input:

1

output:

N

result:

ok "N"

Test #4:

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

input:

549755813888

output:

Y

result:

ok "Y"

Test #5:

score: -100
Wrong Answer
time: 6ms
memory: 11064kb

input:

274877906944

output:

Y

result:

wrong answer 1st words differ - expected: 'N', found: 'Y'