結果
| 問題 | 
                            No.1318 ABCD quadruplets
                             | 
                    
| コンテスト | |
| ユーザー | 
                             stoq
                         | 
                    
| 提出日時 | 2020-12-16 06:23:49 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 695 bytes | 
| コンパイル時間 | 133 ms | 
| コンパイル使用メモリ | 30,976 KB | 
| 最終ジャッジ日時 | 2025-01-17 01:51:03 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 23 TLE * 7 | 
コンパイルメッセージ
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;
  for (a = 0; a * a <= n and a <= m; a++)
  {
    for (b = 0; b * b <= n - a * a and b <= m; b++)
      for (c = 0; c * c <= n - a * a - a * b - b * b and c <= m; c++)
      {
        for (d = 0; d * d <= n - a * a - b * b - c * c - a * b - b * c and 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)
            cnt[t]++;
        }
      }
  }
  for (i = 0; i <= n; i++)
    printf("%d\n", cnt[i]);
}
            
            
            
        
            
stoq