Submission #642901

#TimeUsernameProblemLanguageResultExecution timeMemory
642901valerikkWorst Reporter 3 (JOI18_worst_reporter3)C++17
12 / 100
1702 ms28372 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...