結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー tailstails
提出日時 2021-11-18 16:59:24
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 476 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 29,132 KB
実行使用メモリ 5,444 KB
最終ジャッジ日時 2023-08-08 07:52:37
合計ジャッジ時間 5,419 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
5,444 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 52 ms
4,380 KB
testcase_03 AC 98 ms
4,380 KB
testcase_04 AC 137 ms
4,560 KB
testcase_05 AC 137 ms
4,608 KB
testcase_06 AC 136 ms
4,576 KB
testcase_07 AC 136 ms
5,288 KB
testcase_08 AC 137 ms
5,272 KB
testcase_09 AC 136 ms
5,224 KB
testcase_10 AC 123 ms
4,380 KB
testcase_11 AC 130 ms
4,380 KB
testcase_12 AC 118 ms
4,376 KB
testcase_13 AC 125 ms
4,920 KB
testcase_14 AC 129 ms
5,040 KB
testcase_15 AC 116 ms
4,784 KB
testcase_16 AC 136 ms
4,488 KB
testcase_17 AC 136 ms
4,620 KB
testcase_18 AC 136 ms
4,608 KB
testcase_19 AC 135 ms
5,324 KB
testcase_20 AC 136 ms
5,332 KB
testcase_21 AC 136 ms
5,228 KB
testcase_22 AC 123 ms
4,380 KB
testcase_23 AC 130 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 23 ms
4,380 KB
testcase_29 AC 11 ms
4,376 KB
testcase_30 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:11:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
   11 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:30:9: 警告: 関数 ‘printf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   30 |         printf("%d.%09d\n",z/1000000000,z%1000000000);
      |         ^~~~~~
main.c:1:1: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’
  +++ |+#include <stdio.h>
    1 | #pragma GCC optimize("Ofast")
main.c:30:9: 警告: 組み込み関数 ‘printf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
   30 |         printf("%d.%09d\n",z/1000000000,z%1000000000);
      |         ^~~~~~
main.c:30:9: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #

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

char*mmap();

#define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define rep(v,e) for(long v=0;v<e;++v)

long l[200000];

main(){
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	rd(n);
	rep(i,n){
		rd(li);
		l[i]=li*1000000000;
	}
	rd(k);
	long z=0;
	for(long d=1l<<62;d;d>>=1){
		long t=z+d;
		long c=0;
		rep(i,n){
			c+=l[i]/t;
		}
		if(c>=k){
			z=t;
		}
	}
	printf("%d.%09d\n",z/1000000000,z%1000000000);
}
0