QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#499380 | #6728. To the Park | Umok | WA | 0ms | 3484kb | C++20 | 1.2kb | 2024-07-31 13:34:54 | 2024-07-31 13:34:54 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
const int N = 1e5 + 5;
#define int long long
#define MAX LONG_LONG_MAX
int ar[N];
void solve()
{
int n;
cin >> n;
for (int i = 1; i <= n + 1; i++)
ar[i] = 0;
queue<int> q;
for (int i = 2; i <= n - 1; i++)
{
if (i % 2)
{
for (int j = 2; j * i <= n; j++)
{
if (ar[i * j])
continue;
q.push(i);
q.push(i * j);
}
}
else
{
if (ar[i])
continue;
int j = i;
for (j = i + 2; j <= n; j += 2)
if (ar[j])
continue;
if (j > n)
continue;
ar[i] = ar[j] = 1;
q.push(i);
q.push(j);
}
}
cout << q.size() / 2 << " ";
while (!q.empty())
{
cout << q.front() << " ";
q.pop();
}
cout << endl;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int tcase;
cin >> tcase;
while (tcase--)
solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3484kb
input:
3 1 4 6
output:
0 0 1 3 6
result:
wrong answer Case #2: Participant has a worse answer