# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1050583 | handlename | Longest beautiful sequence (IZhO17_subsequence) | C++17 | 1 ms | 4700 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define float long double
const int MOD=1e9+7;
// const int MOD=998244353;
const int sqn=450;
const long double eps=1e-6;
const int dx[4]={0,0,1,-1};
const int dy[4]={1,-1,0,0};
long long power(long long a,long long b,long long p=MOD){
long long res=1;
while (b>0){
if (b%2==1) res=(res*a)%p;
b/=2;
a=(a*a)%p;
}
return res;
}
int n,arr[100001],brr[100001];
// idea 1: dp1[x] = LBS ending with x
// idea 2: dp2[i][k] = max length of LBS ending with x
// over all x such that bitcount(x&i)=k
// for idea 2, we get O(1) transitions
// but we then need to update O(M) states in dp2
// idea 1 has O(M) transition, O(1) affected states
// idea 2 has O(1) transition, O(M) affected states
int dp[1100][1100][11],from[1100][1100][11],prv[100001];
// main idea is to split X into its left and right bits
Compilation message (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... |