Submission #72493442
Source Code Expand
#include <iostream>
#include <set>
using namespace std;
const int K = 3170, M = 1e7 + 5;
int n, cnt = 0;
bool vis[M], ans[M];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= K; i++)
for (int j = i + 1; j <= K; j++) {
int x = i * i + j * j;
if (x <= n) {
if (vis[x])
ans[x] = false;
else
vis[x] = ans[x] = true;
}
}
for (int i = 1; i <= n; i++)
cnt += ans[i];
cout << cnt << "\n";
for (int i = 1; i <= n; i++)
if (ans[i])
cout << i << " ";
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - 2026 |
| User | real01bit |
| Language | C++23 (GCC 15.2.0) |
| Score | 300 |
| Code Size | 704 Byte |
| Status | AC |
| Exec Time | 98 ms |
| Memory | 26928 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_corner_00.txt, 02_corner_01.txt, 02_corner_02.txt, 02_corner_03.txt, 02_corner_04.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 3 ms | 3464 KiB |
| 00_sample_01.txt | AC | 3 ms | 3504 KiB |
| 00_sample_02.txt | AC | 3 ms | 3428 KiB |
| 01_random_00.txt | AC | 39 ms | 11820 KiB |
| 01_random_01.txt | AC | 85 ms | 23824 KiB |
| 01_random_02.txt | AC | 38 ms | 11824 KiB |
| 01_random_03.txt | AC | 87 ms | 24920 KiB |
| 01_random_04.txt | AC | 25 ms | 8664 KiB |
| 01_random_05.txt | AC | 45 ms | 13684 KiB |
| 01_random_06.txt | AC | 31 ms | 10020 KiB |
| 01_random_07.txt | AC | 29 ms | 9380 KiB |
| 01_random_08.txt | AC | 42 ms | 13252 KiB |
| 01_random_09.txt | AC | 95 ms | 26092 KiB |
| 02_corner_00.txt | AC | 4 ms | 3484 KiB |
| 02_corner_01.txt | AC | 97 ms | 26848 KiB |
| 02_corner_02.txt | AC | 98 ms | 26924 KiB |
| 02_corner_03.txt | AC | 97 ms | 26928 KiB |
| 02_corner_04.txt | AC | 97 ms | 26724 KiB |