Submission #72196634
Source Code Expand
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> count(N + 1, 0);
int max_y = sqrt(N) + 1;
for (int y = 2; y <= max_y; ++y) {
int y2 = y * y;
for (int x = 1; x < y; ++x) {
int sum = x * x + y2;
if (sum > N) {
break;
}
count[sum]++;
}
}
vector<int> ans;
for (int n = 1; n <= N; ++n) {
if (count[n] == 1) {
ans.push_back(n);
}
}
int k = ans.size();
cout << k << endl;
if (k > 0) {
for (int i = 0; i < k; ++i) {
cout << ans[i];
if (i < k - 1) cout << " ";
}
cout << endl;
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - 2026 |
| User | WoodyLee |
| Language | C++23 (GCC 15.2.0) |
| Score | 300 |
| Code Size | 810 Byte |
| Status | AC |
| Exec Time | 110 ms |
| Memory | 49956 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 | 1 ms | 3552 KiB |
| 00_sample_01.txt | AC | 1 ms | 3464 KiB |
| 00_sample_02.txt | AC | 1 ms | 3584 KiB |
| 01_random_00.txt | AC | 45 ms | 22032 KiB |
| 01_random_01.txt | AC | 95 ms | 44188 KiB |
| 01_random_02.txt | AC | 45 ms | 21692 KiB |
| 01_random_03.txt | AC | 97 ms | 46432 KiB |
| 01_random_04.txt | AC | 27 ms | 14556 KiB |
| 01_random_05.txt | AC | 53 ms | 25296 KiB |
| 01_random_06.txt | AC | 36 ms | 18572 KiB |
| 01_random_07.txt | AC | 32 ms | 17200 KiB |
| 01_random_08.txt | AC | 50 ms | 24160 KiB |
| 01_random_09.txt | AC | 104 ms | 48448 KiB |
| 02_corner_00.txt | AC | 2 ms | 3620 KiB |
| 02_corner_01.txt | AC | 106 ms | 49888 KiB |
| 02_corner_02.txt | AC | 110 ms | 49824 KiB |
| 02_corner_03.txt | AC | 109 ms | 49764 KiB |
| 02_corner_04.txt | AC | 109 ms | 49956 KiB |