結果

問題 No.877 Range ReLU Query
ユーザー ei1333333
提出日時 2019-09-06 23:19:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 492 bytes
コンパイル時間 3,597 ms
コンパイル使用メモリ 214,352 KB
最終ジャッジ日時 2025-01-07 16:58:58
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18 TLE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |   scanf("%d %d", &N, &Q);
      |   ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |     scanf("%d", &A[i]);
      |     ~~~~~^~~~~~~~~~~~~
main.cpp:22:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |     scanf("%d %d %d %d", &a, &b, &c, &d);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

// とおってー!

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;


int main() {
  int N, Q;
  int A[100000];
  scanf("%d %d", &N, &Q);
  for(int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  for(int i = 0; i < Q; i++) {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    --b;
    int64 ret = 0;
    for(int j = b; j < c; j++) ret += max(A[j] - d, 0);
    printf("%lld\n", ret);
  }
}

0