| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 94430 | Kastanda | Longest beautiful sequence (IZhO17_subsequence) | C++11 | 12 ms | 1784 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 100005, SQ = 1024;
int n, ts, A[N], K[N], P[N], R[N];
pair < int , int > dp[SQ][SQ][11];
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &A[i]);
    for (int i = 1; i <= n; i++)
        scanf("%d", &K[i]);
    int nw = 0, _max = 0;
    for (int i = 1; i <= n; i++)
    {
        int a = A[i], k = K[i];
        pair < int , int > Mx = {0, 0};
        for (int j = 0; j < SQ; j++)
            Mx = max(Mx, dp[j][a & (SQ - 1)][k - __builtin_popcount(a >> 10 & j)]);
        Mx.first ++;
        P[i] = Mx.second;
        Mx.second = i;
        for (int j = 0; j < SQ; j++)
        {
            int kk = __builtin_popcount(a & (SQ - 1) & j);
            dp[a >> 10][j][kk] = max(dp[a >> 10][j][kk], Mx);
        }
        if (Mx.first > _max)
            _max = Mx.first, nw = i;
    }
    while (nw)
    {
        R[ts ++] = nw;
        nw = P[nw];
    }
    printf("%d\n", ts);
    for (int i = ts - 1; ~i; i--)
        printf("%d ", R[i]);
    return 0;
}
컴파일 시 표준 에러 (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... | ||||
