QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#614056 | #4629. Longest Increasing Subsequence | badminton | WA | 0ms | 3712kb | C++14 | 1.7kb | 2024-10-05 15:30:11 | 2024-10-05 15:30:16 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll,ll> pll;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;
#define forr(_a,_b,_c) for(int _a = (_b); _a <= int (_c); ++_a)
#define ford(_a,_b,_c) for(int _a = (_b) + 1; _a --> int (_c);)
#define forf(_a,_b,_c) for(int _a = (_b); _a < int (_c); ++_a)
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define mask(i) (1LL << (i))
#define bit(x, i) (((x) >> (i)) & 1)
#define bp __builtin_popcountll
#define file "test"
template<class X, class Y>
bool minz(X &x, const Y &y) {
if (x > y) {
x = y;
return true;
} return false;
}
template<class X, class Y>
bool maxz(X &x, const Y &y) {
if (x < y) {
x = y;
return true;
} return false;
}
const int N = 5e5 + 5;
const ll oo = (ll) 1e16;
const ll mod = 1e9 + 7; // 998244353;
ll n, a[N], f[70];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef hqm
freopen(file".inp", "r", stdin); freopen(file".out", "w", stdout);
#endif
cin >> n;
forr (i, 1, n){
cin >> a[i];
}
forr (j, 0, 60)
f[j] = 1;
forf (i, 1, n){
ll u = (a[i + 1] - a[i] - 1) - mask(__lg(a[i + 1] - a[i] - 2)) + 1;
ford (j, __lg(a[i + 1] - a[i] - 2) + 1, 1){
f[j] += mask(j - 1);
u = (u - 1) / 2 + 1;
}
f[0]++;
forr (j, 1, 60)
maxz(f[j], f[j - 1]);
}
cout << max (n, f[60]) << "\n";
return 0;
}
/*
*/
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
input:
7 7 41 53 58 75 78 81
output:
33
result:
wrong answer 1st lines differ - expected: '22', found: '33'