結果

問題 No.1441 MErGe
ユーザー 沙耶花沙耶花
提出日時 2021-02-08 16:27:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 585 bytes
コンパイル時間 2,153 ms
コンパイル使用メモリ 202,876 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-06 18:03:54
合計ジャッジ時間 17,930 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 5 ms
6,944 KB
testcase_06 AC 4 ms
6,940 KB
testcase_07 AC 4 ms
6,944 KB
testcase_08 AC 29 ms
6,940 KB
testcase_09 AC 28 ms
6,940 KB
testcase_10 AC 61 ms
6,940 KB
testcase_11 AC 53 ms
6,944 KB
testcase_12 AC 65 ms
6,944 KB
testcase_13 AC 909 ms
6,944 KB
testcase_14 AC 903 ms
6,944 KB
testcase_15 AC 811 ms
6,944 KB
testcase_16 AC 891 ms
6,940 KB
testcase_17 AC 839 ms
6,944 KB
testcase_18 AC 74 ms
6,940 KB
testcase_19 AC 89 ms
6,944 KB
testcase_20 AC 69 ms
6,940 KB
testcase_21 AC 62 ms
6,940 KB
testcase_22 AC 83 ms
6,940 KB
testcase_23 AC 849 ms
6,940 KB
testcase_24 AC 863 ms
6,940 KB
testcase_25 AC 856 ms
6,940 KB
testcase_26 AC 850 ms
6,940 KB
testcase_27 AC 847 ms
6,944 KB
testcase_28 TLE -
testcase_29 TLE -
権限があれば一括ダウンロードができます

ソースコード

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