Submission #30899

#TimeUsernameProblemLanguageResultExecution timeMemory
30899NavickBrunhilda’s Birthday (BOI13_brunhilda)C++14
20.63 / 100
1000 ms80144 KiB
#include <bits/stdc++.h> #define F first #define S second #define pii pair<int, int> #define pb push_back using namespace std; typedef long long ll; typedef long double ld; const int N = 1e7 + 10, INF = 1e9; int dp[N], p[N]; int main(){ int m, q; scanf("%d %d", &m, &q); for(int i=0; i<m; i++) scanf("%d", p + i); for(int i=1; i<N; i++){ //dp[i] ?! int mr = 0; for(int j=m - 1; j>=0 && mr < p[j]; j--) mr = max(mr, i % p[j]); if(mr == 0){ dp[i] = 0; break; } else dp[i] = dp[i - mr] + 1; } for(int i=0; i<q; i++){ int n; scanf("%d", &n); if(dp[n] == 0) printf("oo\n"); else printf("%d\n", dp[n]); } }

Compilation message (stderr)

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:17:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int m, q; scanf("%d %d", &m, &q);
                                  ^
brunhilda.cpp:20:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", p + i);
                     ^
brunhilda.cpp:35:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int n; scanf("%d", &n);
                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...