Submission #1221879

#TimeUsernameProblemLanguageResultExecution timeMemory
1221879slivajanFinancial Report (JOI21_financial)C++20
14 / 100
86 ms2632 KiB
#include <bits/stdc++.h> using namespace std; using un = long long; using vuc = vector<un>; using vol = vector<bool>; #define REP(i, a, b) for (un i = (un)a ; i < (un)b; i++) #define FEAC(i, a) for (auto&& i : a) #define vec vector #define ALL(x) (x).begin(), (x).end() int main(){ un N, D; cin >> N >> D; vuc A(N); FEAC(a, A) cin >> a; if (N > 20) return 0; un ret = 0; REP(m, 0, 1<<(N-1)){ vuc indeces; REP(i, 0, N-1){ if ((1<<i) & m) indeces.push_back(i); } indeces.push_back(N-1); un max_d = 0; REP(i, 1, indeces.size()){ un d = indeces[i] - indeces[i-1]; max_d = max(max_d, d); } if (max_d > D) continue; un score = 1; un max_trzba = A[indeces[0]]; REP(i, 1, indeces.size()){ if (A[indeces[i]] > max_trzba){ score++; max_trzba = A[indeces[i]]; } } ret = max(ret, score); } cout << ret << endl; }
#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...