제출 #940530

#제출 시각아이디문제언어결과실행 시간메모리
940530RifalFinancial Report (JOI21_financial)C++14
0 / 100
4053 ms2652 KiB
#include <bits/stdc++.h> #include <fstream> #define endl '\n' #define mod 1000000007 #define INF 2000000000 #define INF2 1000000000000000000 ///#define cin fin ///#define cout fout using namespace std; double const EPS = 1e-14; typedef long long ll; ///ofstream fout("herding.out"); ///ifstream fin("herding.in"); int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n, d; cin >> n >> d; long long arr[n]; int ans = 0; for(int i = 0; i < n; i++) cin >> arr[i]; for(long long i = 0; i < (1ll<<n); i++) { int last = -1, mx = 0, cnt = 0; bool ok = true, ok2 = false; for(long long j = 0; j < n; j++) { if((i&(1ll<<j)) > 0 ) { if(last != -1 && abs(last-j) > d) { ok = false; break; } if(mx < arr[j]) { cnt++; mx = arr[j]; } if(j == n-1) { ok2 = true; } last = j; } } if(!ok || !ok2) continue; else ans = max(ans,cnt); } cout << ans << endl; return 0; }
#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...