結果

問題 No.1546 [Cherry 2nd Tune D] 思ったよりも易しくない
ユーザー tailstails
提出日時 2021-06-14 18:58:28
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 29,716 KB
実行使用メモリ 12,644 KB
最終ジャッジ日時 2023-08-26 04:16:53
合計ジャッジ時間 8,711 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,940 KB
testcase_01 AC 1 ms
4,944 KB
testcase_02 AC 1 ms
4,948 KB
testcase_03 AC 1 ms
5,012 KB
testcase_04 AC 1 ms
4,944 KB
testcase_05 AC 0 ms
4,940 KB
testcase_06 AC 0 ms
4,948 KB
testcase_07 AC 1 ms
5,004 KB
testcase_08 AC 0 ms
5,004 KB
testcase_09 AC 0 ms
5,008 KB
testcase_10 AC 0 ms
5,008 KB
testcase_11 AC 0 ms
5,008 KB
testcase_12 AC 0 ms
4,952 KB
testcase_13 AC 6 ms
5,300 KB
testcase_14 AC 12 ms
11,300 KB
testcase_15 AC 7 ms
6,584 KB
testcase_16 AC 6 ms
6,436 KB
testcase_17 AC 5 ms
5,144 KB
testcase_18 AC 9 ms
8,452 KB
testcase_19 AC 8 ms
7,876 KB
testcase_20 AC 10 ms
9,440 KB
testcase_21 AC 1 ms
4,948 KB
testcase_22 AC 9 ms
8,408 KB
testcase_23 AC 8 ms
7,356 KB
testcase_24 AC 2 ms
4,944 KB
testcase_25 AC 13 ms
11,728 KB
testcase_26 AC 13 ms
12,240 KB
testcase_27 AC 7 ms
6,568 KB
testcase_28 AC 13 ms
12,240 KB
testcase_29 AC 13 ms
12,180 KB
testcase_30 AC 13 ms
12,272 KB
testcase_31 AC 13 ms
12,300 KB
testcase_32 AC 13 ms
12,260 KB
testcase_33 AC 13 ms
12,260 KB
testcase_34 AC 13 ms
12,160 KB
testcase_35 AC 13 ms
12,220 KB
testcase_36 AC 13 ms
12,264 KB
testcase_37 AC 13 ms
12,160 KB
testcase_38 AC 13 ms
12,232 KB
testcase_39 AC 14 ms
12,232 KB
testcase_40 AC 13 ms
12,228 KB
testcase_41 AC 13 ms
12,216 KB
testcase_42 AC 14 ms
12,296 KB
testcase_43 AC 10 ms
9,852 KB
testcase_44 AC 10 ms
9,928 KB
testcase_45 AC 11 ms
9,960 KB
testcase_46 AC 11 ms
9,936 KB
testcase_47 AC 10 ms
9,852 KB
testcase_48 AC 13 ms
12,644 KB
testcase_49 AC 13 ms
12,328 KB
testcase_50 AC 0 ms
4,948 KB
testcase_51 AC 0 ms
4,948 KB
testcase_52 AC 0 ms
5,012 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:15:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
   15 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:37:9: 警告: 関数 ‘write’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   37 |         write(1,wp,wbuf+sizeof wbuf-wp);
      |         ^~~~~
main.c:38:9: 警告: implicit declaration of function ‘_exit’; did you mean ‘_Exit’? [-Wimplicit-function-declaration]
   38 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

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

char*mmap();
#define rd(v) long v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define wt(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);}
#define rep(v,e) for(long v=0;v<e;++v)

#define MD     998244353
#define inv24  291154603

int t[300001];
int v[300001];

main(){
	long s=0,l=0,r=0;
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	rd(n);
	rep(i,n){
		rd(ti);
		s+=ti%=MD;
		t[i]=ti;
		rd(vi);
		v[i]=vi;
	}
	s%=MD;
	rep(i,n){
		l+=t[i];
		l-=l>=MD?MD:0;
		r+=l*(l+1)%MD*(l+2)%MD*(s*4-(l-1)*3)%MD*(v[i]-v[i+1])%MD;
	}
	r=r%MD*inv24%MD;
	r+=r>=0?0:MD;

	char wbuf[64],*wp=wbuf+sizeof wbuf;
	wt(r);
	write(1,wp,wbuf+sizeof wbuf-wp);
	_exit(0);
}
0