結果
問題 |
No.1441 MErGe
|
ユーザー |
![]() |
提出日時 | 2021-02-08 16:27:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 1,909 ms |
コンパイル使用メモリ | 194,304 KB |
最終ジャッジ日時 | 2025-01-18 16:25:12 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 TLE * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d %d",&N,&Q); | ~~~~~^~~~~~~~~~~~~~~ main.cpp:20:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%lld",&S[i+1]); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:26:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d %d %d",&T,&l,&r); | ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#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; }