| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 36928 | top34051 | Longest beautiful sequence (IZhO17_subsequence) | C++14 | 5229 ms | 48780 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define X first
#define Y second
const int maxn = 1e5 + 5;
const int cut = 1024;
int n;
int p[maxn], k[maxn];
int cnt[cut];
int dp[maxn], rec[cut][cut][11];
int track[maxn];
vector<int> res;
int main() {
    int i,x,y,a,b;
    pii ans;
    scanf("%d",&n);
    for(i=1;i<=n;++i) scanf("%d",&p[i]);
    for(i=1;i<=n;++i) scanf("%d",&k[i]);
    for(x=0;x<cut;++x) cnt[x] = __builtin_popcount(x);
    ans = {0,0};
    for(i=1;i<=n;++i) {
        a = p[i]>>10; b = p[i]%cut; dp[i] = 1;
        //fix C (x)
        for(x=0;x<cut;++x) {
            int want = k[i] - cnt[a&x];
            if(want<0 || want>10) continue;
            int pos = rec[x][b][want];
            if(dp[i] < dp[pos] + 1) dp[i] = dp[pos] + 1, track[i] = pos;
        }
        if(ans.X < dp[i]) ans = make_pair(dp[i], i);
        //fix B (x)
        for(x=0;x<cut;++x) {
            int want = cnt[b&x];
            int pos = rec[a][x][want];
            if(dp[pos] < dp[i]) rec[a][x][want] = i;
        }
    }
    printf("%d\n",ans.X);
    x = ans.Y;
    while(x) res.emplace_back(x), x = track[x];
    reverse(res.begin(), res.end());
    for(auto t : res) printf("%d ",t);
}
컴파일 시 표준 에러 (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... | ||||
