提出 #72241190
ソースコード 拡げる
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(), v.end()
#define memo(v, x) memset(v, x, sizeof(v))
#define sz(v) (int)v.size()
void solve() {
ll n; cin >> n;
vector<ll> mp(n + 5);
for (ll i = 1; i * i <= n; i++) {
for (ll j = i + 1; j <= n && (i * i + j * j) <= n; j++) {
mp[i*i + j*j]++;
}
}
vector<ll> ans;
for (int i = 1; i <= n; i++) {
if (mp[i] == 1) {
ans.push_back(i);
}
}
cout << sz(ans) << '\n';
for (auto &x : ans) cout << x << " ";
}
int main() {
cin.tie(0) -> sync_with_stdio(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int tc = 1;
// cin >> tc;
for (int t = 1; t <= tc; t++) {
solve();
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - 2026 |
| ユーザ | georginio |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 300 |
| コード長 | 789 Byte |
| 結果 | AC |
| 実行時間 | 133 ms |
| メモリ | 92492 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| 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 |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3576 KiB |
| 00_sample_01.txt | AC | 1 ms | 3496 KiB |
| 00_sample_02.txt | AC | 1 ms | 3492 KiB |
| 01_random_00.txt | AC | 54 ms | 40484 KiB |
| 01_random_01.txt | AC | 114 ms | 81896 KiB |
| 01_random_02.txt | AC | 53 ms | 39784 KiB |
| 01_random_03.txt | AC | 120 ms | 85792 KiB |
| 01_random_04.txt | AC | 33 ms | 25500 KiB |
| 01_random_05.txt | AC | 65 ms | 46576 KiB |
| 01_random_06.txt | AC | 42 ms | 33536 KiB |
| 01_random_07.txt | AC | 38 ms | 31032 KiB |
| 01_random_08.txt | AC | 59 ms | 44600 KiB |
| 01_random_09.txt | AC | 126 ms | 89660 KiB |
| 02_corner_00.txt | AC | 2 ms | 3668 KiB |
| 02_corner_01.txt | AC | 133 ms | 92328 KiB |
| 02_corner_02.txt | AC | 130 ms | 92492 KiB |
| 02_corner_03.txt | AC | 130 ms | 92392 KiB |
| 02_corner_04.txt | AC | 130 ms | 92292 KiB |