Submission #811971

#TimeUsernameProblemLanguageResultExecution timeMemory
811971vjudge1Financial Report (JOI21_financial)C++17
0 / 100
4033 ms1492 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 >= (1<<(n - 1)); 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; } 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() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...