結果

問題 No.749 クエリ全部盛り
ユーザー testestesttestestest
提出日時 2018-04-18 19:02:57
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 558 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 29,520 KB
実行使用メモリ 21,656 KB
最終ジャッジ日時 2023-09-09 11:24:26
合計ジャッジ時間 6,017 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
13,924 KB
testcase_01 AC 8 ms
9,656 KB
testcase_02 AC 8 ms
9,636 KB
testcase_03 AC 8 ms
9,596 KB
testcase_04 AC 8 ms
9,656 KB
testcase_05 AC 9 ms
9,712 KB
testcase_06 AC 9 ms
9,664 KB
testcase_07 AC 9 ms
9,604 KB
testcase_08 AC 9 ms
9,600 KB
testcase_09 AC 9 ms
9,620 KB
testcase_10 AC 95 ms
9,728 KB
testcase_11 AC 95 ms
9,780 KB
testcase_12 AC 94 ms
9,712 KB
testcase_13 AC 96 ms
9,680 KB
testcase_14 AC 96 ms
9,612 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=l;i<r;i++)

#define M 1000000007
ll f[1000010];
ll a[1000010];

int main(){
	f[1]=1;
	rep(i,2,1000003)f[i]=(f[i-1]+f[i-2])%M;
	int Q;
	scanf("%*d%d",&Q);
	
	while(Q--){
		int q,l,r,k;
		scanf("%d%d%d%d",&q,&l,&r,&k);
		if(q==0){
			ll ans=0;
			rep(i,l,r+1)ans=(ans+a[i])%M;
			printf("%d\n",ans*k%M);
		}
		else if(q==1)rep(i,l,r+1)a[i]=k;
		else if(q==2)rep(i,l,r+1)a[i]=(a[i]+k)%M;
		else if(q==3)rep(i,l,r+1)a[i]=a[i]*k%M;
		else if(q==4)rep(i,l,r+1)a[i]=(a[i]+k*f[i])%M;
	}
	return 0;
}
0