Submission #642901

# Submission time Handle Problem Language Result Execution time Memory
642901 2022-09-20T18:26:06 Z valerikk Worst Reporter 3 (JOI18_worst_reporter3) C++17
12 / 100
1702 ms 28372 KB
#include <cstdio>

#define MAXN 500005
#define MAXT 1005

int N, Q;
int D[MAXN];
int T[MAXN], L[MAXN], R[MAXN];
int ans[MAXN];
int a[MAXN];

int main() {
  scanf("%d%d", &N, &Q);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &D[i]);
  }
  for (int i = 0; i < Q; ++i) {
    scanf("%d%d%d", &T[i], &L[i], &R[i]);
  }

  for (int i = 0; i < Q; ++i) {
    ans[i] = (T[i] >= L[i] && T[i] <= R[i]);
  }

  for (int t = 1; t <= MAXT; ++t) {
    ++a[1];
    for (int i = 1; i <= N && a[i] >= D[i]; ++i) {
      if (i != N) 
        a[i + 1] += a[i];
      a[i] = 0;
    }

    for (int i = 0; i < Q; ++i) {
      if (T[i] == t) {
        int X = t;
        for (int j = 1; j <= N; ++j) {
          X -= a[j] + 1;
          ans[i] += (X >= L[i] && X <= R[i]);
        }
      }
    }
  }

  for (int i = 0; i < Q; ++i) {
    printf("%d\n", ans[i]);
  }
}

Compilation message

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d", &N, &Q);
      |   ~~~~~^~~~~~~~~~~~~~~~
worst_reporter3.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%d", &D[i]);
      |     ~~~~~^~~~~~~~~~~~~
worst_reporter3.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d%d%d", &T[i], &L[i], &R[i]);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1702 ms 28372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 2 ms 308 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1702 ms 28372 KB Output isn't correct
2 Halted 0 ms 0 KB -