結果
問題 | No.1318 ABCD quadruplets |
ユーザー | tnakao0123 |
提出日時 | 2020-12-19 01:21:33 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 193 ms / 2,000 ms |
コード長 | 1,207 bytes |
コンパイル時間 | 1,568 ms |
コンパイル使用メモリ | 94,724 KB |
実行使用メモリ | 4,428 KB |
最終ジャッジ日時 | 2023-10-21 08:36:08 |
合計ジャッジ時間 | 4,641 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,348 KB |
testcase_01 | AC | 1 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 | 1 ms
4,348 KB |
testcase_11 | AC | 2 ms
4,348 KB |
testcase_12 | AC | 2 ms
4,348 KB |
testcase_13 | AC | 5 ms
4,348 KB |
testcase_14 | AC | 68 ms
4,348 KB |
testcase_15 | AC | 3 ms
4,348 KB |
testcase_16 | AC | 91 ms
4,348 KB |
testcase_17 | AC | 11 ms
4,348 KB |
testcase_18 | AC | 61 ms
4,348 KB |
testcase_19 | AC | 29 ms
4,356 KB |
testcase_20 | AC | 4 ms
4,348 KB |
testcase_21 | AC | 12 ms
4,348 KB |
testcase_22 | AC | 14 ms
4,348 KB |
testcase_23 | AC | 184 ms
4,428 KB |
testcase_24 | AC | 179 ms
4,428 KB |
testcase_25 | AC | 42 ms
4,428 KB |
testcase_26 | AC | 26 ms
4,348 KB |
testcase_27 | AC | 119 ms
4,428 KB |
testcase_28 | AC | 44 ms
4,428 KB |
testcase_29 | AC | 54 ms
4,428 KB |
testcase_30 | AC | 183 ms
4,428 KB |
testcase_31 | AC | 43 ms
4,428 KB |
testcase_32 | AC | 193 ms
4,428 KB |
ソースコード
/* -*- coding: utf-8 -*- * * 1318.cc: No.1318 ABCD quadruplets - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ const int MAX_N = 160000; const int pns[8] = { 1, 4, 6, 12, 4, 12, 12, 24 }; /* typedef */ /* global variables */ int ss[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n, m; scanf("%d%d", &n, &m); for (int a = 0; a <= m; a++) { int sa = a * a; if (sa > n) break; for (int b = a; b <= m; b++) { int sb = sa + (a + b) * b; if (sb > n) break; for (int c = b; c <= m; c++) { int sc = sb + (a + b + c) * c; if (sc > n) break; for (int d = c; d <= m; d++) { int sd = sc + (a + b + c + d) * d; if (sd > n) break; int bits = 0; if (a < b) bits |= 1; if (b < c) bits |= 2; if (c < d) bits |= 4; ss[sd] += pns[bits]; } } } } for (int i = 0; i <= n; i++) printf("%d\n", ss[i]); return 0; }