結果

問題 No.1318 ABCD quadruplets
ユーザー milanis48663220milanis48663220
提出日時 2020-12-15 01:04:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,306 bytes
コンパイル時間 781 ms
コンパイル使用メモリ 96,132 KB
実行使用メモリ 8,148 KB
最終ジャッジ日時 2023-10-20 05:33:12
合計ジャッジ時間 7,121 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 130 ms
4,348 KB
testcase_14 TLE -
testcase_15 AC 33 ms
4,348 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

int sq(int x){ return x*x; }

int calc(int a, int b, int c, int d){
    return (sq(a+b+c+d)+sq(a)+sq(b)+sq(c)+sq(d))/2;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int n, m; cin >> n >> m;
    vector<int> ans(n+1);
    for(int a = 0; a <= m; a++){
        for(int b = 0; b <= m; b++){
            if(sq(a+b) > 2*n) break;
            for(int c = 0; c <= m; c++){
                if(sq(a+b+c) > 2*n) break;
                for(int d = 0; d <= m; d++){
                    if(sq(a+b+c+d) > 2*n) break;
                    int x = calc(a, b, c, d);
                    if(x <= n) ans[x]++;
                }
            }
        }
    }
    for(int x: ans) cout << x << endl;
}
0