結果

問題 No.1514 Squared Matching
ユーザー tailstails
提出日時 2021-05-22 10:38:06
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 192 ms / 4,000 ms
コード長 548 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 31,104 KB
実行使用メモリ 50,240 KB
最終ジャッジ日時 2024-04-18 17:32:13
合計ジャッジ時間 4,117 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 192 ms
50,160 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 3 ms
6,940 KB
testcase_07 AC 28 ms
11,904 KB
testcase_08 AC 181 ms
49,416 KB
testcase_09 AC 147 ms
42,916 KB
testcase_10 AC 166 ms
47,228 KB
testcase_11 AC 172 ms
48,508 KB
testcase_12 AC 172 ms
49,084 KB
testcase_13 AC 178 ms
49,840 KB
testcase_14 AC 186 ms
49,980 KB
testcase_15 AC 182 ms
50,108 KB
testcase_16 AC 185 ms
50,076 KB
testcase_17 AC 184 ms
50,120 KB
testcase_18 AC 190 ms
50,228 KB
testcase_19 AC 190 ms
50,240 KB
testcase_20 AC 189 ms
50,136 KB
testcase_21 AC 184 ms
50,124 KB
testcase_22 AC 30 ms
12,076 KB
testcase_23 AC 61 ms
22,632 KB
testcase_24 AC 97 ms
31,536 KB
testcase_25 AC 138 ms
40,756 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:11:1: warning: return type defaults to 'int' [-Wimplicit-int]
   11 | main(){
      | ^~~~
main.c: In function 'main':
main.c:28:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   28 |         write(1,wp,wbuf+sizeof wbuf-wp);
      |         ^~~~~
main.c:29:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   29 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

#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;}

#define wt_rev(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);}

char vis[50000001];

main(){
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	rd(n);
	long res=0;
	for(long i=1;i<=n;++i){
		if(!vis[i]){
			long count=1;
			for(int j=2,ijj;ijj=i*j*j,ijj<=n;++j){
				vis[ijj]=1;
				count+=1;
			}
			res+=count*count;
		}
	}

	char wbuf[64],*wp=wbuf+sizeof wbuf;
	wt_rev(res);
	write(1,wp,wbuf+sizeof wbuf-wp);
	_exit(0);
}
0