Submission #811998

#TimeUsernameProblemLanguageResultExecution timeMemory
811998vjudge1Financial Report (JOI21_financial)C++17
Compilation error
0 ms0 KiB
#ifdef Home #define _GLIBCXX_DEBUG #endif // Home #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; int lg2(int x) { return 31 - __builtin_clz(x); } main() { #ifdef Home freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // Home ios_base::sync_with_stdio(0); cin.tie(0); int n, d; cin >> n >> d; int arr[n]; for(int i = 0; i < n; ++ i) { cin >> arr[i]; } int ans = 0; for(int msk = (1<<n); msk --> 0;) { int k = 0; for(int tmp = msk, pr = -1, cr, mx = 0; tmp; tmp -= (-tmp&tmp)) { cr = lg2(-tmp&tmp); if(pr != -1 && cr - pr > d) { k = 0; break; } if(mx < arr[cr]) { ++ k; mx = arr[cr]; } pr = cr; } if(pr == n - 1) { ans = max(ans, k); } } cout << ans; }

Compilation message (stderr)

Main.cpp:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 | main() {
      | ^~~~
Main.cpp: In function 'int main()':
Main.cpp:45:12: error: 'pr' was not declared in this scope
   45 |         if(pr == n - 1) {
      |            ^~