Submission #220206

#TimeUsernameProblemLanguageResultExecution timeMemory
220206patrikpavic2Worst Reporter 3 (JOI18_worst_reporter3)C++17
12 / 100
2088 ms4988 KiB
#include <cstdio> #include <cstring> #include <vector> #define X first #define Y second #define PB push_back using namespace std; typedef long long ll; const int N = 5e5 + 500; ll D[N]; int n, q; int kolko(ll T,ll L,ll R){ ll tren = T; int ans = 0; //printf("TIME = %lld\n", T); for(int i = 0;i <= n;i++){ //printf("POS[ %d ] = %lld\n", i, tren * D[i] - i); if(L <= tren * D[i] - i && tren * D[i] - i <= R) ans++; if(i != n) tren = tren / (D[i + 1] / D[i]); if(!tren) break; } return ans; } int main(){ scanf("%d%d", &n, &q); D[0] = 1; for(int i = 1;i <= n;i++){ scanf("%lld", D + i); if(D[i] < D[i - 1]) D[i] = D[i - 1]; else if(D[i] % D[i - 1]) D[i] += D[i - 1] - D[i] % D[i - 1]; } for(;q--;){ ll A, B, C; scanf("%lld%lld%lld", &A, &B, &C); printf("%d\n", kolko(A, B, C)); } return 0; }

Compilation message (stderr)

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:34:7: 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:37:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", D + i);
   ~~~~~^~~~~~~~~~~~~~~
worst_reporter3.cpp:44:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   ll A, B, C; scanf("%lld%lld%lld", &A, &B, &C);
               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...