結果

問題 No.1441 MErGe
ユーザー 沙耶花沙耶花
提出日時 2021-02-08 16:23:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 630 bytes
コンパイル時間 2,223 ms
コンパイル使用メモリ 197,244 KB
実行使用メモリ 14,008 KB
最終ジャッジ日時 2024-04-20 10:34:59
合計ジャッジ時間 19,701 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
11,684 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 3 ms
6,944 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 6 ms
6,940 KB
testcase_06 AC 7 ms
6,944 KB
testcase_07 AC 7 ms
6,940 KB
testcase_08 AC 214 ms
6,940 KB
testcase_09 AC 204 ms
6,940 KB
testcase_10 AC 356 ms
6,940 KB
testcase_11 AC 264 ms
6,940 KB
testcase_12 AC 411 ms
6,940 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 609 ms
6,944 KB
testcase_19 AC 734 ms
6,940 KB
testcase_20 AC 465 ms
6,940 KB
testcase_21 AC 384 ms
6,944 KB
testcase_22 AC 532 ms
6,944 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000000



int main(){
	
	int N,Q;
	
	scanf("%d %d",&N,&Q);
	
	vector<long long> S(N,0LL);
	
	rep(i,N){
		scanf("%lld",&S[i]);
	}
	
	rep(_,Q){
		int T,l,r;
		scanf("%d %d %d",&T,&l,&r);
		l--;r--;
		if(T==1){
			for(int i=l+1;i<=r;i++)S[l] += S[i];
			S.erase(S.begin()+l+1,S.begin()+r+1);
		}
		else{
			long long ans = 0LL;
			for(int i=l;i<=r;i++)ans += S[i];
			printf("%lld\n",ans);
		}
		
	}
	
	return 0;
}
0