| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 167748 | abil | Longest beautiful sequence (IZhO17_subsequence) | C++14 | 6027 ms | 12760 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define all(s) s.begin(),s.end()
//#define int long long
using namespace std;
const int N = ((1 << 20) + 12);
const int mod = (1e9 + 7);
const int INF = (0x3f3f3f3f);
int a[N], dp[N], path[N], k[N], bit[N], ind[N];
main()
{
	int n;
	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]);
	}
	for(int i = 0;i < (1 << 20); i++){
		bit[i] = __builtin_popcount(i);
	}
	for(int i = 1;i <= n; i++){
		int mx = 1, id = 0;
		for(int j = 0;j < (1 << 20); j++){
			if(bit[(j & a[i])] == k[i]){
				if(dp[j] + 1 > mx){
					mx = dp[j] + 1;
					id = ind[j];
				}			
			}
		}
		if(mx > dp[a[i]]){
			dp[a[i]] = mx;
			path[i] = id;
			ind[a[i]] = i;		
		}
	}
	int mx = 0, val;
	for(int i = 0; i < (1 << 20); i++){
		if(dp[i] > mx){
			mx = dp[i];
			val = ind[i];
		}
	}
	printf("%d\n", mx);
	vector<int > ans;
	while(val){
		ans.pb(val);
		val = path[val];
	}
	reverse(all(ans));
	for(auto to : ans){
		 printf("%d ", 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... | ||||
