結果

問題 No.1037 exhausted
ユーザー tailstails
提出日時 2021-01-05 21:47:36
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 31,616 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-24 00:52:03
合計ジャッジ時間 1,242 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,948 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 8 ms
6,940 KB
testcase_13 AC 7 ms
6,940 KB
testcase_14 AC 7 ms
6,940 KB
testcase_15 AC 6 ms
6,940 KB
testcase_16 AC 7 ms
6,944 KB
testcase_17 AC 7 ms
6,940 KB
testcase_18 AC 7 ms
6,940 KB
testcase_19 AC 7 ms
6,940 KB
testcase_20 AC 1 ms
6,944 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:9:1: warning: return type defaults to 'int' [-Wimplicit-int]
    9 | main(){
      | ^~~~
main.c: In function 'main':
main.c:21:25: warning: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   21 |                         puts("-1");
      |                         ^~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'puts'
  +++ |+#include <stdio.h>
    1 | #pragma GCC optimize("Ofast")
main.c:22:25: warning: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
   22 |                         exit(0);
      |                         ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
  +++ |+#include <stdlib.h>
    1 | #pragma GCC optimize("Ofast")
main.c:22:25: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   22 |                         exit(0);
      |                         ^~~~
main.c:22:25: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c:39:17: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   39 |                 exit(0);
      |                 ^~~~
main.c:39:17: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c:41:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   41 |         printf("%ld",d[l]);
      |         ^~~~~~
main.c:41:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:41:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:41:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

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

long d[5000000];

main(){
	char*rp=mmap(0l,1l<<28,1,2,0,0ll);
	while(*rp++>=48);
	RD(f);
	RD(l);

	int b=f;
	do{
		RD(x);
		RD(v);
		RD(w);
		if(x>b){
			puts("-1");
			exit(0);
		}
		int c=b+v<x+f?b+v:x+f;
		int i=c;
		int j=c-v;
		for(;i>b;--i){
			d[i]=d[j]+w;
			j-=j>x;
		}
		for(;i>x;--i){
			d[i]=d[i]<d[j]+w?d[i]:d[j]+w;
			j-=j>x;
		}
		b=c;
	}while(*rp);
	if(l>b){
		puts("-1");
		exit(0);
	}
	printf("%ld",d[l]);
}
0