結果
問題 |
No.1318 ABCD quadruplets
|
ユーザー |
![]() |
提出日時 | 2020-12-16 06:33:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 859 bytes |
コンパイル時間 | 546 ms |
コンパイル使用メモリ | 31,700 KB |
最終ジャッジ日時 | 2025-01-17 01:51:11 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 30 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 6 | main() | ^~~~ main.cpp: In function ‘int main()’: main.cpp:9:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d %d", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") main() { int n, m; scanf("%d %d", &n, &m); int cnt[160010] = {}; int a, b, c, d, t, i; int p[] = {24, 12, 3, 1}; for (a = 0; a * a <= n && a <= m; a++) { for (b = a; b * b <= n - a * a && b <= m; b++) for (c = b; c * c <= n - a * a - a * b - b * b && c <= m; c++) { for (d = c; d * d <= n - a * a - b * b - c * c - a * b - b * c && d <= m; d++) { t = a * a + b * b + c * c + d * d + a * b + a * c + a * d + b * c + b * d + c * d; if (t > n) continue; if (a == b and b != c and c == d) cnt[t] += 4; else cnt[t] += p[(a == b) + (b == c) + (c == d)]; } } } for (i = 0; i <= n; i++) printf("%d\n", cnt[i]); }