QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#497548 | #3797. Wireless Communication Network | KryptonK | AC ✓ | 221ms | 78192kb | C++20 | 7.3kb | 2024-07-29 13:25:03 | 2024-07-29 13:25:04 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
#define F first
#define S second
using LL = long long;
using pii = pair<int,int>;
using pil = pair<int,LL>;
using pli = pair<LL,int>;
using pll = pair<LL,LL>;
#define str string
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define si(x) int(x.size())
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define LB lower_bound
#define UB upper_bound
#define i28 __int128
using ull = unsigned long long;
#define one(X) memset((X), -1, sizeof((X)))
#define zero(X) memset((X), 0, sizeof((X)))
#define ar array
#ifndef ONLINE_JUDGE
#include "/Users/zonghong_0731/template/debug.cpp"
#else
#define debug(...)
#define debugArr(...)
#endif
//for loop
#define rep1(n) for(LL i=0; i<(LL)(n); ++i)
#define rep2(i,n) for(LL i=0; i<(LL)(n); ++i)
#define rep3(i,a,b) for(LL i=(LL)(a); i<(LL)(b); ++i)
#define rep4(i,a,b,c) for(LL i=(LL)(a); i<(LL)(b); i+=(c))
#define cut4(a,b,c,d,e,...) e
#define rep(...) cut4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define per1(n) for(LL i=((LL)n)-1; i>=0; --i)
#define per2(i,n) for(LL i=((LL)n)-1; i>=0; --i)
#define per3(i,a,b) for(LL i=((LL)a)-1; i>=(LL)(b); --i)
#define per4(i,a,b,c) for(LL i=((LL)a)-1; i>=(LL)(b); i-=(c))
#define per(...) cut4(__VA_ARGS__,per4,per3,per2,per1)(__VA_ARGS__)
#define rep_subset(i,s) for(LL i=(s); i>=0; i=(i==0?-1:(i-1)&(s)))
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
template<class t> using vvvc = vc<vvc<t>>;
#define vv(type,name,n,...) \
vector<vector<type>> name(n,vector<type>(__VA_ARGS__))
#define vvv(type,name,n,m,...) \
vector<vector<vector<type>>> name(n,vector<vector<type>>(m,vector<type>(__VA_ARGS__)))
using vi = vc<int>;
using vl = vc<LL>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
//bit manipulation referenced from maroonrk
template<class T> int topbit(T t){return t==0?-1:63-__builtin_clzll(t);}
template<class T> int botbit(T t){return t==0?64:__builtin_ctzll(t);}
template<class T> int popcount(T t){return __builtin_popcountll(t);}
template<typename T> T gcd(T a,T b){ return b>0 ? gcd(b,a%b):a;}
template<typename T, typename TT> istream& operator >> (istream& i, pair<T,TT> &p){return i >> p.F >> p.S;}
template<typename T, typename TT> ostream& operator << (ostream& o, const pair<T,TT> &p){return o << p.F << ' ' << p.S;}
//cin vc<T>
template<typename T> istream& operator >> (istream& i, vc<T> &v){for(auto &x: v) i >> x; return i;}
//print 管理
template<typename T> void W(vector<vector<T>>& x){for(auto i: x){ for(auto j: i){cout << j << ' ';} cout << "\n";}}
template<typename T> void W(vector<T>& x){for(auto i: x) cout << i << ' ';cout << "\n";}
template<typename T> void W(set<T>& x){for(auto i: x) cout << i << ' ';cout << "\n";}
template<typename T> void W(unordered_set<T>& x){for(auto i: x) cout << i << ' ';cout << "\n";}
template<typename T> void W(T && x) {cout << x << "\n";}
template<typename T, typename... S> void W(T && x, S&&... y) {cout << x << ' ';W(y...);}
template <class t> using mxheap = priority_queue<t>;
template <class t> using mnheap = priority_queue<t,vc<t>,greater<t>>;
LL binpow(LL a, LL b, LL MOD){
LL res = 1;
while(b){
if(b & 1) res = (res * a) % MOD;
a = (a * a) % MOD;
b >>= 1;
}
return res;
}
const int inf = 1e9;
const LL linf = 2e18;
const LL dx[4] = {1,0,-1,0};
const LL dy[4] = {0,1,0,-1};
const LL dx8[8] = {-1,-1,-1,0,0,1,1,1};
const LL dy8[8] = {-1,0,1,-1,1,-1,0,1};
// segtree 普通區間合併 referenced from jiangly
template<class Info>
struct SegmentTree {
int n;
std::vector<Info> info;
SegmentTree() : n(0) {}
SegmentTree(int n_, Info v_ = Info()) {
init(n_, v_);
}
template<class T>
SegmentTree(std::vector<T> init_) {
init(init_);
}
void init(int n_, Info v_ = Info()) {
init(std::vector(n_, v_));
}
template<class T>
void init(std::vector<T> init_) {
n = init_.size();
info.assign(4 << topbit(n), Info());
std::function<void(int, int, int)> build = [&](int p, int l, int r) {
if (r - l == 1) {
info[p] = init_[l];
return;
}
int m = (l + r) / 2;
build(2 * p, l, m);
build(2 * p + 1, m, r);
pull(p);
};
build(1, 0, n);
}
void pull(int p) {
info[p] = info[2 * p] + info[2 * p + 1];
}
void modify(int p, int l, int r, int x, const Info &v) {
if (r - l == 1) {
info[p] = v;
return;
}
int m = (l + r) / 2;
if (x < m) {
modify(2 * p, l, m, x, v);
} else {
modify(2 * p + 1, m, r, x, v);
}
pull(p);
}
void modify(int p, const Info &v) {
modify(1, 0, n, p, v);
}
Info rangeQuery(int p, int l, int r, int x, int y) {
if (l >= y || r <= x) {
return Info();
}
if (l >= x && r <= y) {
return info[p];
}
int m = (l + r) / 2;
return rangeQuery(2 * p, l, m, x, y) + rangeQuery(2 * p + 1, m, r, x, y);
}
Info rangeQuery(int l, int r) {
return rangeQuery(1, 0, n, l, r);
}
template<class F>
int findFirst(int p, int l, int r, int x, int y, F pred) {
if (l >= y || r <= x || !pred(info[p])) {
return -1;
}
if (r - l == 1) {
return l;
}
int m = (l + r) / 2;
int res = findFirst(2 * p, l, m, x, y, pred);
if (res == -1) {
res = findFirst(2 * p + 1, m, r, x, y, pred);
}
return res;
}
template<class F>
int findFirst(int l, int r, F pred) {
return findFirst(1, 0, n, l, r, pred);
}
template<class F>
int findLast(int p, int l, int r, int x, int y, F pred) {
if (l >= y || r <= x || !pred(info[p])) {
return -1;
}
if (r - l == 1) {
return l;
}
int m = (l + r) / 2;
int res = findLast(2 * p + 1, m, r, x, y, pred);
if (res == -1) {
res = findLast(2 * p, l, m, x, y, pred);
}
return res;
}
template<class F>
int findLast(int l, int r, F pred) {
return findLast(1, 0, n, l, r, pred);
}
};
struct Info {
int mx = -1e9, p = -1;
};
Info operator+(Info a, Info b) {
return {max(a.mx, b.mx), a.mx > b.mx ? a.p : b.p};
}
void CAO_DONG_FAN(){
int n;
cin >> n;
vi a(n);
cin >> a;
SegmentTree<Info> seg(n);
rep(n) {
seg.modify(i, {a[i], (int)i});
}
auto dc = [&](auto dc, int l, int r) -> pll {
if (l > r) return {-1e9, -1e9};
if (r == l) return {0, 0};
int mxp = seg.rangeQuery(l, r + 1).p;
pll L = dc(dc, l, mxp - 1), R = dc(dc, mxp + 1, r);
return {max({L.F + 1, R.F + 1, L.S + R.S + 2}), max(L.S, R.S) + 1};
};
W(dc(dc, 0, n - 1).F);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while(t--){
CAO_DONG_FAN();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 219ms
memory: 31376kb
input:
1000000 113501 958200 129777 204669 144689 505829 196620 372713 150467 264501 551022 435761 764113 642344 28014 882720 994040 530166 192364 711438 611510 38183 574666 655695 582851 103474 43636 994936 663384 174586 621996 560209 686491 894160 493610 924045 54482 84945 2479 958324 330979 288441 90205...
output:
91
result:
ok single line: '91'
Test #2:
score: 0
Accepted
time: 196ms
memory: 30080kb
input:
888888 113501 129776 204668 144688 505828 196619 372712 150466 264500 551021 435760 764112 642343 28013 882719 530164 192362 711436 611508 38181 574664 655693 582849 103472 43634 663381 174583 621993 560206 686488 493606 54477 84940 2474 330973 288435 35306 44146 667284 104067 244335 737772 724728 6...
output:
95
result:
ok single line: '95'
Test #3:
score: 0
Accepted
time: 216ms
memory: 31320kb
input:
999990 113501 958200 129777 204669 144689 505829 196620 372713 150467 264501 551022 435761 764113 642344 28014 882720 994040 530166 192364 711438 611510 38183 574666 655695 582851 103474 43636 994936 663384 174586 621996 560209 686491 894160 493610 924045 54482 84945 2479 958324 330979 288441 902059...
output:
94
result:
ok single line: '94'
Test #4:
score: 0
Accepted
time: 218ms
memory: 31444kb
input:
999992 113501 958200 129777 204669 144689 505829 196620 372713 150467 264501 551022 435761 764113 642344 28014 882720 994040 530166 192364 711438 611510 38183 574666 655695 582851 103474 43636 994936 663384 174586 621996 560209 686491 894160 493610 924045 54482 84945 2479 958324 330979 288441 902059...
output:
94
result:
ok single line: '94'
Test #5:
score: 0
Accepted
time: 221ms
memory: 31156kb
input:
999994 113501 958200 129777 204669 144689 505829 196620 372713 150467 264501 551022 435761 764113 642344 28014 882720 994040 530166 192364 711438 611510 38183 574666 655695 582851 103474 43636 994936 663384 174586 621996 560209 686491 894160 493610 924045 54482 84945 2479 958324 330979 288441 902059...
output:
99
result:
ok single line: '99'
Test #6:
score: 0
Accepted
time: 210ms
memory: 31328kb
input:
999996 113501 958200 129777 204669 144689 505829 196620 372713 150467 264501 551022 435761 764113 642344 28014 882720 994040 530166 192364 711438 611510 38183 574666 655695 582851 103474 43636 994936 663384 174586 621996 560209 686491 894160 493610 924045 54482 84945 2479 958324 330979 288441 902059...
output:
92
result:
ok single line: '92'
Test #7:
score: 0
Accepted
time: 212ms
memory: 31256kb
input:
999999 113501 958200 129777 204669 144689 505829 196620 372713 150467 264501 551022 435761 764113 642344 28014 882720 994040 530166 192364 711438 611510 38183 574666 655695 582851 103474 43636 994936 663384 174586 621996 560209 686491 894160 493610 924045 54482 84945 2479 958324 330979 288441 902059...
output:
92
result:
ok single line: '92'
Test #8:
score: 0
Accepted
time: 213ms
memory: 78192kb
input:
999997 999997 999996 999995 999994 999993 999992 999991 999990 999989 999988 999987 999986 999985 999984 999983 999982 999981 999980 999979 999978 999977 999976 999975 999974 999973 999972 999971 999970 999969 999968 999967 999966 999965 999964 999963 999962 999961 999960 999959 999958 999957 999956...
output:
999996
result:
ok single line: '999996'
Test #9:
score: 0
Accepted
time: 212ms
memory: 78192kb
input:
999998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
output:
999997
result:
ok single line: '999997'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
3 1 2 3
output:
2
result:
ok single line: '2'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
3 1 3 2
output:
2
result:
ok single line: '2'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
3 2 1 3
output:
2
result:
ok single line: '2'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
3 2 3 1
output:
2
result:
ok single line: '2'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
3 3 1 2
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
3 3 2 1
output:
2
result:
ok single line: '2'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
4 1 2 3 4
output:
3
result:
ok single line: '3'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
4 1 2 4 3
output:
3
result:
ok single line: '3'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3492kb
input:
4 1 3 2 4
output:
3
result:
ok single line: '3'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
4 1 3 4 2
output:
3
result:
ok single line: '3'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
4 1 4 2 3
output:
3
result:
ok single line: '3'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
4 1 4 3 2
output:
3
result:
ok single line: '3'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
4 2 1 3 4
output:
3
result:
ok single line: '3'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
4 2 1 4 3
output:
3
result:
ok single line: '3'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
4 2 3 1 4
output:
3
result:
ok single line: '3'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
4 2 3 4 1
output:
3
result:
ok single line: '3'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
4 2 4 1 3
output:
3
result:
ok single line: '3'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
4 2 4 3 1
output:
3
result:
ok single line: '3'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
4 3 1 2 4
output:
3
result:
ok single line: '3'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
4 3 1 4 2
output:
3
result:
ok single line: '3'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
4 3 2 1 4
output:
3
result:
ok single line: '3'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
4 3 2 4 1
output:
3
result:
ok single line: '3'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
4 3 4 1 2
output:
3
result:
ok single line: '3'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
4 3 4 2 1
output:
3
result:
ok single line: '3'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
4 4 1 2 3
output:
3
result:
ok single line: '3'
Test #35:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
4 4 1 3 2
output:
3
result:
ok single line: '3'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
4 4 2 1 3
output:
3
result:
ok single line: '3'
Test #37:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
4 4 2 3 1
output:
3
result:
ok single line: '3'
Test #38:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
4 4 3 1 2
output:
3
result:
ok single line: '3'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
4 4 3 2 1
output:
3
result:
ok single line: '3'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 1 2 3 4 5
output:
4
result:
ok single line: '4'
Test #41:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 1 2 3 5 4
output:
4
result:
ok single line: '4'
Test #42:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
5 1 2 4 3 5
output:
4
result:
ok single line: '4'
Test #43:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 1 2 4 5 3
output:
4
result:
ok single line: '4'
Test #44:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
5 1 2 5 3 4
output:
4
result:
ok single line: '4'
Test #45:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 1 2 5 4 3
output:
4
result:
ok single line: '4'
Test #46:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
5 1 3 2 4 5
output:
4
result:
ok single line: '4'
Test #47:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 1 3 2 5 4
output:
3
result:
ok single line: '3'
Test #48:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
5 1 3 4 2 5
output:
4
result:
ok single line: '4'
Test #49:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
5 1 3 4 5 2
output:
4
result:
ok single line: '4'
Test #50:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5 1 3 5 2 4
output:
4
result:
ok single line: '4'
Test #51:
score: 0
Accepted
time: 0ms
memory: 3492kb
input:
5 1 3 5 4 2
output:
4
result:
ok single line: '4'
Test #52:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
5 1 4 2 3 5
output:
4
result:
ok single line: '4'
Test #53:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 1 4 2 5 3
output:
3
result:
ok single line: '3'
Test #54:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 1 4 3 2 5
output:
4
result:
ok single line: '4'
Test #55:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5 1 4 3 5 2
output:
3
result:
ok single line: '3'
Test #56:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
5 1 4 5 2 3
output:
4
result:
ok single line: '4'
Test #57:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
5 1 4 5 3 2
output:
4
result:
ok single line: '4'
Test #58:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 1 5 2 3 4
output:
4
result:
ok single line: '4'
Test #59:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
5 1 5 2 4 3
output:
3
result:
ok single line: '3'
Test #60:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
5 1 5 3 2 4
output:
4
result:
ok single line: '4'
Test #61:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
5 1 5 3 4 2
output:
3
result:
ok single line: '3'
Test #62:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 1 5 4 2 3
output:
4
result:
ok single line: '4'
Test #63:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
5 1 5 4 3 2
output:
4
result:
ok single line: '4'
Test #64:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
5 2 1 3 4 5
output:
4
result:
ok single line: '4'
Test #65:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
5 2 1 3 5 4
output:
4
result:
ok single line: '4'
Test #66:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
5 2 1 4 3 5
output:
4
result:
ok single line: '4'
Test #67:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 2 1 4 5 3
output:
4
result:
ok single line: '4'
Test #68:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 2 1 5 3 4
output:
4
result:
ok single line: '4'
Test #69:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
5 2 1 5 4 3
output:
4
result:
ok single line: '4'
Test #70:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5 2 3 1 4 5
output:
4
result:
ok single line: '4'
Test #71:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 2 3 1 5 4
output:
3
result:
ok single line: '3'
Test #72:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 2 3 4 1 5
output:
4
result:
ok single line: '4'
Test #73:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 2 3 4 5 1
output:
4
result:
ok single line: '4'
Test #74:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
5 2 3 5 1 4
output:
4
result:
ok single line: '4'
Test #75:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 2 3 5 4 1
output:
4
result:
ok single line: '4'
Test #76:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
5 2 4 1 3 5
output:
4
result:
ok single line: '4'
Test #77:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 2 4 1 5 3
output:
3
result:
ok single line: '3'
Test #78:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 2 4 3 1 5
output:
4
result:
ok single line: '4'
Test #79:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
5 2 4 3 5 1
output:
3
result:
ok single line: '3'
Test #80:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
5 2 4 5 1 3
output:
4
result:
ok single line: '4'
Test #81:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 2 4 5 3 1
output:
4
result:
ok single line: '4'
Test #82:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
5 2 5 1 3 4
output:
4
result:
ok single line: '4'
Test #83:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
5 2 5 1 4 3
output:
3
result:
ok single line: '3'
Test #84:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 2 5 3 1 4
output:
4
result:
ok single line: '4'
Test #85:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 2 5 3 4 1
output:
3
result:
ok single line: '3'
Test #86:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 2 5 4 1 3
output:
4
result:
ok single line: '4'
Test #87:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
5 2 5 4 3 1
output:
4
result:
ok single line: '4'
Test #88:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
5 3 1 2 4 5
output:
4
result:
ok single line: '4'
Test #89:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 3 1 2 5 4
output:
4
result:
ok single line: '4'
Test #90:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
5 3 1 4 2 5
output:
4
result:
ok single line: '4'
Test #91:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 3 1 4 5 2
output:
4
result:
ok single line: '4'
Test #92:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
5 3 1 5 2 4
output:
4
result:
ok single line: '4'
Test #93:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 3 1 5 4 2
output:
4
result:
ok single line: '4'
Test #94:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
5 3 2 1 4 5
output:
4
result:
ok single line: '4'
Test #95:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
5 3 2 1 5 4
output:
4
result:
ok single line: '4'
Test #96:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
5 3 2 4 1 5
output:
4
result:
ok single line: '4'
Test #97:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
5 3 2 4 5 1
output:
4
result:
ok single line: '4'
Test #98:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 3 2 5 1 4
output:
4
result:
ok single line: '4'
Test #99:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
5 3 2 5 4 1
output:
4
result:
ok single line: '4'
Test #100:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 3 4 1 2 5
output:
4
result:
ok single line: '4'
Test #101:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 3 4 1 5 2
output:
3
result:
ok single line: '3'
Test #102:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
5 3 4 2 1 5
output:
4
result:
ok single line: '4'
Test #103:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
5 3 4 2 5 1
output:
3
result:
ok single line: '3'
Test #104:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 3 4 5 1 2
output:
4
result:
ok single line: '4'
Test #105:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
5 3 4 5 2 1
output:
4
result:
ok single line: '4'
Test #106:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
5 3 5 1 2 4
output:
4
result:
ok single line: '4'
Test #107:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 3 5 1 4 2
output:
3
result:
ok single line: '3'
Test #108:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 3 5 2 1 4
output:
4
result:
ok single line: '4'
Test #109:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 3 5 2 4 1
output:
3
result:
ok single line: '3'
Test #110:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 3 5 4 1 2
output:
4
result:
ok single line: '4'
Test #111:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 3 5 4 2 1
output:
4
result:
ok single line: '4'
Test #112:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 4 1 2 3 5
output:
4
result:
ok single line: '4'
Test #113:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
5 4 1 2 5 3
output:
4
result:
ok single line: '4'
Test #114:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 4 1 3 2 5
output:
4
result:
ok single line: '4'
Test #115:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 4 1 3 5 2
output:
4
result:
ok single line: '4'
Test #116:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
5 4 1 5 2 3
output:
4
result:
ok single line: '4'
Test #117:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
5 4 1 5 3 2
output:
4
result:
ok single line: '4'
Test #118:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 4 2 1 3 5
output:
4
result:
ok single line: '4'
Test #119:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 4 2 1 5 3
output:
4
result:
ok single line: '4'
Test #120:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
5 4 2 3 1 5
output:
4
result:
ok single line: '4'
Test #121:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 4 2 3 5 1
output:
4
result:
ok single line: '4'
Test #122:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
5 4 2 5 1 3
output:
4
result:
ok single line: '4'
Test #123:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 4 2 5 3 1
output:
4
result:
ok single line: '4'
Test #124:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 4 3 1 2 5
output:
4
result:
ok single line: '4'
Test #125:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
5 4 3 1 5 2
output:
4
result:
ok single line: '4'
Test #126:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 4 3 2 1 5
output:
4
result:
ok single line: '4'
Test #127:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
5 4 3 2 5 1
output:
4
result:
ok single line: '4'
Test #128:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 4 3 5 1 2
output:
4
result:
ok single line: '4'
Test #129:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 4 3 5 2 1
output:
4
result:
ok single line: '4'
Test #130:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 4 5 1 2 3
output:
4
result:
ok single line: '4'
Test #131:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
5 4 5 1 3 2
output:
3
result:
ok single line: '3'
Test #132:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
5 4 5 2 1 3
output:
4
result:
ok single line: '4'
Test #133:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 4 5 2 3 1
output:
3
result:
ok single line: '3'
Test #134:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 4 5 3 1 2
output:
4
result:
ok single line: '4'
Test #135:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
5 4 5 3 2 1
output:
4
result:
ok single line: '4'
Test #136:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
5 5 1 2 3 4
output:
4
result:
ok single line: '4'
Test #137:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
5 5 1 2 4 3
output:
4
result:
ok single line: '4'
Test #138:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
5 5 1 3 2 4
output:
4
result:
ok single line: '4'
Test #139:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
5 5 1 3 4 2
output:
4
result:
ok single line: '4'
Test #140:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
5 5 1 4 2 3
output:
4
result:
ok single line: '4'
Test #141:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5 5 1 4 3 2
output:
4
result:
ok single line: '4'
Test #142:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
5 5 2 1 3 4
output:
4
result:
ok single line: '4'
Test #143:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
5 5 2 1 4 3
output:
4
result:
ok single line: '4'
Test #144:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 5 2 3 1 4
output:
4
result:
ok single line: '4'
Test #145:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
5 5 2 3 4 1
output:
4
result:
ok single line: '4'
Test #146:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
5 5 2 4 1 3
output:
4
result:
ok single line: '4'
Test #147:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
5 5 2 4 3 1
output:
4
result:
ok single line: '4'
Test #148:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
5 5 3 1 2 4
output:
4
result:
ok single line: '4'
Test #149:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
5 5 3 1 4 2
output:
4
result:
ok single line: '4'
Test #150:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 5 3 2 1 4
output:
4
result:
ok single line: '4'
Test #151:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 5 3 2 4 1
output:
4
result:
ok single line: '4'
Test #152:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
5 5 3 4 1 2
output:
4
result:
ok single line: '4'
Test #153:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
5 5 3 4 2 1
output:
4
result:
ok single line: '4'
Test #154:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
5 5 4 1 2 3
output:
4
result:
ok single line: '4'
Test #155:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
5 5 4 1 3 2
output:
4
result:
ok single line: '4'
Test #156:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
5 5 4 2 1 3
output:
4
result:
ok single line: '4'
Test #157:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 5 4 2 3 1
output:
4
result:
ok single line: '4'
Test #158:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
5 5 4 3 1 2
output:
4
result:
ok single line: '4'
Test #159:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
5 5 4 3 2 1
output:
4
result:
ok single line: '4'
Test #160:
score: 0
Accepted
time: 196ms
memory: 31236kb
input:
999990 113501 770045 433912 639689 129777 552281 204669 976248 144689 884673 196619 590373 372712 686748 150466 724171 264500 739072 26733 545096 435760 940046 239824 831828 118055 605352 28013 524129 358431 694859 469751 641516 5877 868142 192363 991350 187149 530815 87221 661716 38182 911647 50377...
output:
95
result:
ok single line: '95'
Test #161:
score: 0
Accepted
time: 196ms
memory: 31124kb
input:
999992 113501 770046 433912 639690 129777 552282 204669 976249 144689 884674 196619 590374 372712 686749 150466 724172 264500 739073 26733 545097 435760 940047 239824 831829 118055 605353 28013 524130 358431 694860 469751 641517 5877 868143 192363 991351 187149 530816 87221 661717 38182 911648 50377...
output:
89
result:
ok single line: '89'
Test #162:
score: 0
Accepted
time: 201ms
memory: 31396kb
input:
999994 113501 770047 433912 639691 129777 552283 204669 976250 144689 884675 196619 590375 372712 686750 150466 724173 264500 739074 26733 545098 435760 940048 239824 831830 118055 605354 28013 524131 358431 694861 469751 641518 5877 868144 192363 991352 187149 530817 87221 661718 38182 911649 50377...
output:
92
result:
ok single line: '92'
Test #163:
score: 0
Accepted
time: 199ms
memory: 31332kb
input:
999996 113501 770048 433912 639692 129777 552284 204669 976251 144689 884676 196619 590376 372712 686751 150466 724174 264500 739075 26733 545099 435760 940049 239824 831831 118055 605355 28013 524132 358431 694862 469751 641519 5877 868145 192363 991353 187149 530818 87221 661719 38182 911650 50377...
output:
90
result:
ok single line: '90'