Submission #155869

#TimeUsernameProblemLanguageResultExecution timeMemory
155869HellAngelBrunhilda’s Birthday (BOI13_brunhilda)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define Task "test" #define pb emplace_back using namespace std; const int N = int(1e7) + 1; const int inf = int(1e9); int nxt[N], f[N], m, Q, n, x; int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); if(fopen(Task".inp", "r")) { freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> m >> Q; while(m --) { cin >> x; for(int i = x; i <= N; i += x) nxt[i - 1] = max(nxt[i - 1], x - 1); nxt[N - 1] = max(nxt[N - 1], (N - 1) % x); } for(int i = N - 1; i >= 1; --i) nxt[i] = max(nxt[i], nxt[i + 1] - 1); for(int i = 1; i < N; ++i) { if(nxt[i]) f[i] = f[i - nxt[i]] + 1; else f[i] = inf; } while(Q --) { cin >> x; if(f[x] >= inf) cout << "oo\n"; else cout << f[x] << '\n'; }

Compilation message (stderr)

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:34:5: error: expected '}' at end of input
     }
     ^
brunhilda.cpp:16:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen(Task".inp", "r", stdin);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
brunhilda.cpp:17:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen(Task".out", "w", stdout);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~