Submission #945592

#TimeUsernameProblemLanguageResultExecution timeMemory
945592vjudge1Brunhilda’s Birthday (BOI13_brunhilda)C++17
0 / 100
17 ms17244 KiB
#include <bits/stdc++.h> using namespace std; #define N 1000000 int f[N + 10]; int p[N + 10]; int n, m, x, l, r, t, tot = 0; int main(){ scanf("%d%d", &n, &m); for (int i = 1; i < n; i++){ scanf("%d", &x); r = x - 1; for (int j = x; j <= x; j+= x){ p[j] = x; } } l = 1; while (l <= r && r <= N){ tot++; for (int i = l; i <= r; i++){ f[i] = tot; t = max(t, i + p[i] - 1); } t = min(t, N); l = r + 1; r = t; } while (m--){ scanf("%d", &x); if (!f[x]) printf("oo\n"); else printf("%d\n", f[x]); } }

Compilation message (stderr)

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
brunhilda.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d", &x);
      |   ~~~~~^~~~~~~~~~
brunhilda.cpp:30:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |   scanf("%d", &x);
      |   ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...