結果

問題 No.877 Range ReLU Query
ユーザー くれちーくれちー
提出日時 2019-09-06 22:16:12
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 621 bytes
コンパイル時間 1,008 ms
コンパイル使用メモリ 31,808 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-07 00:46:55
合計ジャッジ時間 16,707 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1,034 ms
4,380 KB
testcase_12 AC 854 ms
4,376 KB
testcase_13 AC 580 ms
4,376 KB
testcase_14 AC 574 ms
4,380 KB
testcase_15 AC 1,273 ms
4,380 KB
testcase_16 AC 1,885 ms
4,380 KB
testcase_17 AC 1,949 ms
4,376 KB
testcase_18 AC 1,929 ms
4,380 KB
testcase_19 TLE -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")

#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>

#define MAX_N 100000

int main(void) {
  size_t n, q;
  scanf("%zu%zu", &n, &q);

  int64_t a[MAX_N];

  for (size_t i = 0; i < n; ++i) {
    scanf("%" SCNd64, &a[i]);
  }

  for (size_t i = 0; i < q; ++i) {
    size_t t, l, r;
    int64_t x;
    scanf("%zu%zu%zu%" SCNd64, &t, &l, &r, &x);

    int64_t sum = 0;

    for (size_t j = l - 1; j <= r - 1; ++j) {
      if (a[j] - x > 0) {
        sum += a[j] - x;
      }
    }

    printf("%" PRId64 "\n", sum);
  }
}
0