結果

問題 No.1000 Point Add and Array Add
ユーザー Hasegawa_frogHasegawa_frog
提出日時 2020-02-28 21:50:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 737 bytes
コンパイル時間 1,878 ms
コンパイル使用メモリ 166,236 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-21 18:20:28
合計ジャッジ時間 11,014 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 4 ms
5,376 KB
testcase_16 TLE -
testcase_17 AC 1,872 ms
5,376 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define mod 1000000007
#define inf 1000000000
#define all(x) (x).begin(), (x).end()
#define pb push_back

const long double PI = acos(-1);

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

int main(){
  ll n, q;
  cin >> n >> q;
  vector<ll> a(n);
  for(ll i = 0; i < n; i++) cin >> a[i];

  vector<ll> b(n, 0);
  for(ll i = 0; i < q; i++){
    char c;
    ll x, y;
    cin >> c >> x >> y;
    if(c == 'A'){
      a[x-1] += y;
    }else{
      for(ll j = x-1; j < y; j++){
        b[j] += a[j];
      }
    }
  } 

  for(ll i = 0; i < n; i++){
    cout << b[i] << (i<n-1?" ":"\n");
  }
  return 0;
}
0