QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#362664#8508. DiviDueloucup-team3113#WA 3ms11060kbC++20947b2024-03-23 16:34:432024-03-23 16:34:45

Judging History

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

  • [2024-03-23 16:34:45]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:11060kb
  • [2024-03-23 16:34:43]
  • 提交

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 << ' ';
	
	for(int i = 1; i*i<= n; i++){
		if(!(is_prime[i]) || (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: 0
Wrong Answer
time: 3ms
memory: 11060kb

input:

10

output:

1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 N

result:

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