제출 #44369

#제출 시각아이디문제언어결과실행 시간메모리
44369RayaBurong25_1Worst Reporter 3 (JOI18_worst_reporter3)C++17
7 / 100
953 ms9524 KiB
#include <stdio.h> #include <algorithm> int D[500005]; int E[500005]; int T; typedef struct node node; struct node { int i; }; node V[500005]; int comp1(node element, int value) { return (T/E[element.i]*E[element.i] - element.i) < value; } int comp2(int value, node element) { return (T/E[element.i]*E[element.i] - element.i) > value; } int main() { int N, Q; scanf("%d %d", &N, &Q); int i; D[0] = 1; E[0] = 1; for (i = 1; i <= N; i++) { scanf("%d", &D[i]); if (E[i - 1] == 1) E[i] = D[i]; else E[i] = (D[i]/E[i - 1] + 1)*E[i - 1]; // printf("E%d\n", E[i]); } for (i = 0; i <= N; i++) V[i].i = N - i; int L, R; int l, r; int j; for (i = 0; i < Q; i++) { scanf("%d %d %d", &T, &L, &R); l = std::lower_bound(&V[0], &V[N + 1], L, comp1) - &V[0]; r = std::upper_bound(&V[0], &V[N + 1], R, comp2) - &V[0]; // for (j = 0; j <= N; j++) // printf("#%d\n", T/E[j]*E[j] - j); // printf("l%d r%d\n", l, r); printf("%d\n", r - l); } }

컴파일 시 표준 에러 (stderr) 메시지

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:40:9: warning: unused variable 'j' [-Wunused-variable]
     int j;
         ^
worst_reporter3.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &N, &Q);
     ~~~~~^~~~~~~~~~~~~~~~~
worst_reporter3.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &D[i]);
         ~~~~~^~~~~~~~~~~~~
worst_reporter3.cpp:43:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d", &T, &L, &R);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...