# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
708589 | Matjaz | 아름다운 순열 (IZhO12_beauty) | C++14 | 2705 ms | 164528 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<vector>
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <stack>
#include <string.h>
using namespace std;
long long dp[1<<20][20];
int N;
vector<int> a;
int onesdp[20][4];
int ones(int x, int base){
if (onesdp[x][base] != -1) return onesdp[x][base];
int ans = 0;
int tmp = a[x];
while (tmp > 0){
if (tmp % base == 1) ans++;
tmp /= base;
}
return onesdp[x][base] = ans;
}
bool works(int a, int b){
return ones(a, 2) == ones(b,2) || ones(a, 3) == ones(b, 3);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |