| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 763382 | cheat_when_I_was_young | Financial Report (JOI21_financial) | C++17 | 44 ms | 3588 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// #cheat_when_I_was_young
// #cheatkhitacontre #khionhatoicheat
// #thaycuckythatvong
#include "bits/stdc++.h"
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma")
const int NM = 3e5 + 5;
int n, d, a[NM], res;
vector<int> lis;
vector<pair<int,int>> tmp;
int value() {
int ma = 0, ans = 0;
for (int i = 0; i < tmp.size(); ++i) {
if (i && tmp[i].second - tmp[i-1].second > d) return 0;
if (tmp[i].first > ma) ++ans;
ma = max(ma, tmp[i].first);
}
return ans;
}
void backtrack(int x) {
if (x == n+1) {
res = max(res, value());
return;
}
backtrack(x+1);
tmp.push_back({a[x], x});
backtrack(x+1);
tmp.pop_back();
}
signed main() {
IOS;
cin >> n >> d;
for (int i = 1; i <= n; ++i) cin >> a[i];
if (n <= 20) {
backtrack(1);
cout << res;
return 0;
}
if (d == n) {
for (int i = 1; i <= n; ++i) {
if (!lis.size() || lis.back() < a[i]) lis.push_back(a[i]);
else *lower_bound(lis.begin(), lis.end(), a[i]) = a[i];
}
cout << lis.size();
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
