Submission #6434557


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

const int N = (int) 1e5 + 5;

int n;
int nprime;
int p[N], f[N];

void sieve() {
	int LIM = 55555;
	for  (int i = 2; i <= LIM; i++) {
		if (f[i] == 0) f[i] = p[++nprime] = i;
		int j = 0;
		while (j < nprime && p[j] < f[i] && p[j + 1] * i <= LIM) {
			f[p[j + 1] * i] = p[j + 1];
			j++;
		}
	}
}

int main() {
	//freopen(".inp", "r", stdin); freopen(".out", "w", stdout);
	sieve();
	cin >> n;
	for (int i = 1; i <= n; i++) cout << p[i] << " ";
	return 0;
}

Submission Info

Submission Time
Task D - Five, Five Everywhere
User sesshomalong
Language C++14 (GCC 5.4.1)
Score 0
Code Size 531 Byte
Status WA
Exec Time 2 ms
Memory 512 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
WA × 1
AC × 2
WA × 3
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All in01.txt, in02.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
in01.txt WA 2 ms 512 KB
in02.txt WA 2 ms 512 KB
sample_01.txt AC 2 ms 512 KB
sample_02.txt AC 2 ms 512 KB
sample_03.txt WA 2 ms 512 KB