| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 50313 | mra2322001 | Longest beautiful sequence (IZhO17_subsequence) | C++14 | 5649 ms | 110696 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define f0(i, n) for(int i=(0); i<n; i++)
#define f1(i, n) for(int i=(1); i<=n; i++)
using namespace std;
typedef long long ll;
const int N = 1e5 + 3;
int n, a[N], k[N], f[1024][1024][11];
int d[N], trace[N];
main(){
ios_base::sync_with_stdio(0);
cin >> n;
f1(i, n) cin >> a[i];
f1(i, n) cin >> k[i];
f1(i, n){
int l = a[i] >> 10;
int r = 1023 & a[i], best = 0;
f0(j, 1024){
int kb = __builtin_popcount(j&r);
kb = k[i] - kb;
if(kb < 0 || kb > 10) continue;
if(d[best] < d[f[l][j][kb]]) best = f[l][j][kb];
}
d[i] = d[best] + 1;
trace[i] = best;
f0(j, 1024){
/// f[j][r][kb]
int kb = __builtin_popcount(l&j);
if(d[i] > d[f[j][r][kb]]){
f[j][r][kb] = i;
}
}
}
int ans = 0;
f1(i, n) if(d[i] > d[ans]) ans = i;
cout << d[ans] << endl;
vector <int> save;
for(ans; ans > 0; ans = trace[ans]) save.push_back(ans);
for(int i = save.size() - 1; i >= 0; i--) cout << save[i] << " ";
}
컴파일 시 표준 에러 (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... | ||||
