結果

問題 No.1318 ABCD quadruplets
ユーザー tailstails
提出日時 2020-12-15 13:03:15
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 1,941 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 32,892 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 05:58:10
合計ジャッジ時間 3,345 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 45 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 58 ms
4,348 KB
testcase_17 AC 4 ms
4,348 KB
testcase_18 AC 39 ms
4,348 KB
testcase_19 AC 16 ms
4,348 KB
testcase_20 AC 3 ms
4,348 KB
testcase_21 AC 7 ms
4,348 KB
testcase_22 AC 3 ms
4,348 KB
testcase_23 AC 119 ms
4,348 KB
testcase_24 AC 111 ms
4,348 KB
testcase_25 AC 23 ms
4,348 KB
testcase_26 AC 11 ms
4,348 KB
testcase_27 AC 81 ms
4,348 KB
testcase_28 AC 28 ms
4,348 KB
testcase_29 AC 35 ms
4,348 KB
testcase_30 AC 120 ms
4,348 KB
testcase_31 AC 25 ms
4,348 KB
testcase_32 AC 120 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:12:1: warning: return type defaults to 'int' [-Wimplicit-int]
   12 | main(){
      | ^~~~
main.c: In function 'main':
main.c:71:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   71 |         write(1,wbuf,(wp-wbuf)*sizeof*wbuf);
      |         ^~~~~
main.c:72:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   72 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

// original: https://yukicoder.me/submissions/593409

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

char*mmap();
#define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}

int cnt[160001];
long wbuf[160001];

main(){
	char*rp=mmap(0l,1l<<28,1,2,0,0ll);
	RD(n);
	RD(m);

	int i = 0, sa = 0;
    for (; i <= m; ++i, sa += i * 2 - 1) {
		int j = 0, sb = sa;
        for (; j < i; ++j, sb += i + j * 2 - 1) {
            int k = 0, sc = sb;
            for (; k < j && sc <= n; ++k, sc += i + j + k * 2 - 1) {
			    int l = 0, sd = sc;
                for (; l < k && sd <= n; ++l, sd += i + j + k + l * 2 - 1) {
                    cnt[sd] += 24;  // i>j>k>l
                }
				if (sd <= n) {
                    cnt[sd] += 12;  // i>j>k=l
				}
            }
            if (k == j) {
			    int l = 0, sd = sc;
                for (; l < k && sd <= n; ++l, sd += i + j + k + l * 2 - 1) {
                    cnt[sd] += 12;  // i>j=k>l
                }
				if (sd <= n) {
                    cnt[sd] += 4;   // i>j=k=l
				}
            }
        }
        if (j == i) {
            int k = 0, sc = sb;
            for (; k < j && sc <= n; ++k, sc += i + j + k * 2 - 1) {
			    int l = 0, sd = sc;
                for (; l < k && sd <= n; ++l, sd += i + j + k + l * 2 - 1) {
                    cnt[sd] += 12;  // i=j>k>l
                }
				if (sd <= n) {
                    cnt[sd] += 6;   // i=j>k=l
				}
            }
            if (k == j) {
			    int l = 0, sd = sc;
                for (; l < k && sd <= n; ++l, sd += i + j + k + l * 2 - 1) {
                    cnt[sd] += 4;   // i=j=k>l
                }
				if (sd <= n) {
                    cnt[sd] += 1;   // i=j=k=l
				}
            }
        }
    }

	long*wp=wbuf;
	for(int i=0;i<=n;++i){
		int z=cnt[i];
		long d=0x2020202020202020l;
		while(d=d<<8|z%10+0x30,z/=10);
		*wp++=d^0x2al<<56;
	}
	write(1,wbuf,(wp-wbuf)*sizeof*wbuf);
	_exit(0);
}
0