結果

問題 No.1281 Cigarette Distribution
ユーザー tailstails
提出日時 2020-11-09 11:26:32
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 1,443 ms
コンパイル使用メモリ 32,900 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-29 22:00:25
合計ジャッジ時間 2,553 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 0 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 0 ms
4,380 KB
testcase_09 AC 0 ms
4,380 KB
testcase_10 AC 0 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 11 ms
4,380 KB
testcase_13 AC 19 ms
4,376 KB
testcase_14 AC 19 ms
4,376 KB
testcase_15 AC 10 ms
4,376 KB
testcase_16 AC 13 ms
4,376 KB
testcase_17 AC 0 ms
4,376 KB
testcase_18 AC 23 ms
4,376 KB
testcase_19 AC 23 ms
4,376 KB
testcase_20 AC 22 ms
4,376 KB
testcase_21 AC 22 ms
4,380 KB
testcase_22 AC 22 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:20:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
   20 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:21:9: 警告: 関数 ‘read’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   21 |         read(0,rbuf,sizeof rbuf);
      |         ^~~~
main.c:42:9: 警告: 関数 ‘write’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   42 |         write(1,wp,(wbuf+sizeof wbuf)-wp);
      |         ^~~~~
main.c:43:9: 警告: implicit declaration of function ‘_exit’; did you mean ‘_Exit’? [-Wimplicit-function-declaration]
   43 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

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

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

char wbuf[11*200000];

#define MD 1000000007

long mp(long v,long b,long e){
	while(e){
		if(e&1) v=v*b%MD;
		b=b*b%MD;
		e>>=1;
	}
	return v;
}

main(){
	read(0,rbuf,sizeof rbuf);
	char*rp=rbuf;
	char*wp=wbuf+sizeof wbuf;
	RD(n);
	RD(m);
	++n;
	int x=m;
	for(;x+x>n+8;x-=4){
		*(long*)(wp-=8)=0x0a300a300a300a30l;
	}
	for(;x+x>n;--x){
		*--wp=10;
		*--wp=48;
	}
	for(;x;--x){
		long a=n/x;
		long b=n%x;
		long v=mp(mp(a-1,a+1,b),a,x-b-1);
		*--wp=10;
		while(*--wp=v%10+48,v/=10);
	}
	write(1,wp,(wbuf+sizeof wbuf)-wp);
	_exit(0);
}
0