結果

問題 No.1946 ロッカーの問題
ユーザー tailstails
提出日時 2022-05-21 03:40:29
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 4 ms / 3,000 ms
コード長 761 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 30,580 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 15:33:02
合計ジャッジ時間 1,669 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 4 ms
4,348 KB
testcase_04 AC 3 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 4 ms
4,348 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 4 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'f3':
main.c:41:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   41 |         write(1,wp,wbuf+sizeof wbuf-wp);
      |         ^~~~~
main.c: In function 'main':
main.c:46:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   46 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

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

#define rd_skip() while(*rp++>=48)
#define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) {ulong _z=v;do*--wp=_z%10+48;while(_z/=10);}
#define rep4(v,s,e,t) for(long v=s;v<e;v+=t)
#define rrep3(v,s,e) for(long v=e;--v>=s;)

typedef unsigned long ulong;

char a[200004];

ulong f1(){
	char*mmap();
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	ulong n=rd();
	rd_skip();
	while(*rp){
		a[rd()]=1;
	}
	return n;
}

ulong f2(ulong n){
	ulong z=n;
	rrep3(i,1,n+1){
		ulong x=0;
		rep4(j,i,n+1,i){
			x^=a[j];
		}
		z-=x;
		a[i]=x;
	}
	return z;
}

void f3(ulong z){
	char wbuf[64],*wp=wbuf+sizeof wbuf;
	wt(z);
	write(1,wp,wbuf+sizeof wbuf-wp);
}

int main(){
	f3(f2(f1()));
	_exit(0);
}
0