| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 38304 | Just_Solve_The_Problem | Longest beautiful sequence (IZhO17_subsequence) | C++14 | 5836 ms | 93448 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pii pair < int, int >
#define fr first
#define sc second
const int N = (int)1e5 + 7;
const int m = 1 << 10;
int a[N], k[N];
int bit[m];
pii dp[m][m][11];
int par[N];
main () {
    int n; scanf ("%d", &n);
    for (int j = 0; j < 2; j++)
        for (int i = 1; i <= n; i++)
            if (!j)
                scanf ("%d", a + i);
            else
                scanf ("%d", k + i);
    for (int i = 1; i < m; i++) {
        bit[i] = __builtin_popcount(i);
    }
    int ans, ansid;
    ans = ansid = 0;
    for (int i = 1; i <= n; i++) {
        int pr = (a[i] >> 10);
        int sf = (a[i] % m);
        int mx = 1, id = 0;
        for (int j = 0; j < m; j++) {
            int need = k[i] - bit[j & pr];
            if (need < 0 || need > 10) continue;
            if (mx < dp[j][sf][need].fr + 1) {
                mx = dp[j][sf][need].fr + 1;
                id = dp[j][sf][need].sc;
            }
        }
        par[i] = id;
        for (int j = 0; j < m; j++) {
            int need = bit[j & sf];
            if (dp[pr][j][need].fr < mx) {
                dp[pr][j][need] = {mx, i};
            }
        }
        if (ans < mx) {
            ans = mx;
            ansid = i;
        }
    }
    cout << ans << endl;
    vector < int > asd;
    while (ansid) {
        asd.push_back(ansid);
        ansid = par[ansid];
    }
    reverse(asd.begin(), asd.end());
    for (auto to : asd) {
        cout << to << ' ';
    }
}
컴파일 시 표준 에러 (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... | ||||
