結果

問題 No.1965 Heavier
ユーザー tailstails
提出日時 2022-06-06 22:07:21
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 653 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 30,568 KB
実行使用メモリ 6,152 KB
最終ジャッジ日時 2023-10-21 03:42:22
合計ジャッジ時間 1,793 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 5 ms
5,796 KB
testcase_07 AC 5 ms
5,804 KB
testcase_08 AC 5 ms
5,488 KB
testcase_09 AC 5 ms
5,984 KB
testcase_10 AC 6 ms
5,984 KB
testcase_11 AC 5 ms
5,984 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 6 ms
5,788 KB
testcase_16 AC 6 ms
5,788 KB
testcase_17 AC 4 ms
4,388 KB
testcase_18 AC 7 ms
5,740 KB
testcase_19 AC 6 ms
5,580 KB
testcase_20 AC 6 ms
5,716 KB
testcase_21 AC 6 ms
5,324 KB
testcase_22 AC 5 ms
5,248 KB
testcase_23 AC 4 ms
4,348 KB
testcase_24 AC 4 ms
4,812 KB
testcase_25 AC 5 ms
5,592 KB
testcase_26 AC 5 ms
5,396 KB
testcase_27 AC 5 ms
6,152 KB
testcase_28 AC 5 ms
6,152 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:31:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   31 |         write(1,wp,wbuf+sizeof wbuf-wp);
      |         ^~~~~
main.c:32:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   32 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

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

#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 rep(v,e) for(long v=0;v<e;++v)
#define rep3(v,s,e) for(long v=s;v<e;++v)

typedef unsigned long ulong;

int a[200000];

int main(){
	char*mmap();
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	long n=rd();
	rep(i,n){
		a[i]=rd();
	}
	long y=0,z=0;
	long b0=rd();
	rep3(i,1,n){
		long b1=rd();
		long ad=a[i]-a[i-1];
		long bd=b1-b0;
		z+=y=ad>(bd<0?-bd:bd)?y+1:0;
		b0=b1;
	}
	char wbuf[64],*wp=wbuf+sizeof wbuf;
	wt(z);
	write(1,wp,wbuf+sizeof wbuf-wp);
	_exit(0);
}
0