結果

問題 No.1514 Squared Matching
ユーザー tailstails
提出日時 2021-05-22 10:47:47
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 153 ms / 4,000 ms
コード長 585 bytes
コンパイル時間 439 ms
コンパイル使用メモリ 31,616 KB
実行使用メモリ 7,488 KB
最終ジャッジ日時 2024-04-18 17:32:29
合計ジャッジ時間 3,455 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 145 ms
7,424 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 0 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 27 ms
5,376 KB
testcase_08 AC 140 ms
7,296 KB
testcase_09 AC 120 ms
6,528 KB
testcase_10 AC 134 ms
6,912 KB
testcase_11 AC 138 ms
7,136 KB
testcase_12 AC 148 ms
7,296 KB
testcase_13 AC 143 ms
7,424 KB
testcase_14 AC 146 ms
7,428 KB
testcase_15 AC 144 ms
7,452 KB
testcase_16 AC 146 ms
7,416 KB
testcase_17 AC 153 ms
7,372 KB
testcase_18 AC 147 ms
7,488 KB
testcase_19 AC 143 ms
7,364 KB
testcase_20 AC 144 ms
7,440 KB
testcase_21 AC 142 ms
7,468 KB
testcase_22 AC 29 ms
5,376 KB
testcase_23 AC 57 ms
5,376 KB
testcase_24 AC 88 ms
5,376 KB
testcase_25 AC 115 ms
6,272 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);}

unsigned long vis[50000000/64+2];

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>>6]&1ul<<i)){
			long count=1;
			for(int j=2,ijj;ijj=i*j*j,ijj<=n;++j){
				vis[ijj>>6]|=1ul<<ijj;
				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