QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#351860 | #5035. foo~ | ANIG | 0 | 76ms | 59044kb | C++23 | 1.2kb | 2024-03-12 16:38:04 | 2024-03-12 16:38:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F(i,l,r) for(int i=(l);i<=(r);i++)
#define D(i,l,r) for(int i=(l);i>=(r);i--)
const int N=6e5+5,inf=1e9;
int n,k,w[N],p[N],lst[N],nxt[N],r1,r2,res,ans;
vector<int>st,g1[N],g2[N];
signed main(){
#ifdef zzafanti
freopen("in.txt","r",stdin);
#endif
#ifdef orz
freopen("out.txt","w",stdout);
#endif
cin>>n>>k;
F(i,1,n)cin>>w[i],w[i+n]=w[i];
w[0]=w[2*n+1]=inf;
st.push_back(0);
F(i,1,2*n){
while(w[st.back()]<w[i])st.pop_back();
lst[i]=st.back();
st.push_back(i);
}
st.clear();
st.push_back(2*n+1);
D(i,2*n,1){
while(w[st.back()]<w[i])st.pop_back();
nxt[i]=st.back();
st.push_back(i);
// cout<<i<<"nxt"<<nxt[i]<<endl;
}
F(i,1,2*n)g1[lst[i]].push_back(i),g2[nxt[i]].push_back(i);
F(i,1,n){
if(lst[i]<1)r1++;
r2++;
r2-=g2[i].size();
}
F(i,n+1,2*n){
r2++;
for(auto j:g2[i])r2-=j>=i-n;
r1+=lst[i]<i-n;r1--;
for(auto j:g1[i-n])r1+=j<=i;
if(max(r1,r2)>res){
res=max(r1,r2);
ans=i;
}
}
cout<<res<<endl;
cerr<<ans;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 7704kb
input:
23 6 16 20 22 4 21 10 3 7 5 8 15 12 9 1 6 17 23 13 11 19 18 14 2
output:
7
result:
wrong answer 1st words differ - expected: '20', found: '7'
Subtask #2:
score: 0
Wrong Answer
Test #21:
score: 10
Accepted
time: 34ms
memory: 30264kb
input:
93943 1 87243 48984 50611 19218 77699 25025 85769 28141 13380 34875 42459 66419 53472 4367 48292 16894 92171 87263 42527 67085 30687 29235 27515 81053 31421 34864 83591 70491 75344 7026 50250 63402 26773 5330 36308 76399 80032 15501 16205 71750 73964 67876 68901 70548 2043 79979 89479 19784 38838 44...
output:
25
result:
ok "25"
Test #22:
score: 0
Accepted
time: 48ms
memory: 33864kb
input:
112118 1 24338 1586 3 108269 5 53472 80391 70331 9 15335 62487 28331 13 14 16564 94323 36681 108815 32632 44382 21 22 23 24 11758 40070 21518 51991 109983 30 45524 59784 33 2068 62111 36 37 38 39 89031 30508 42 43 16414 110006 34303 47 10331 44651 50 93957 95407 22019 88681 56605 12426 28498 58 59 8...
output:
281
result:
ok "281"
Test #23:
score: -10
Wrong Answer
time: 76ms
memory: 59044kb
input:
391400 1 158965 280194 3 4 5 369036 92293 245923 57403 10 6887 280754 277300 110148 314164 135940 17 46573 126951 111447 301107 22 23 24 25 26 247952 28 342994 339309 23647 350245 33 299608 35 36 37 263236 232063 40 41 42 43 44 39280 46 299122 11961 380375 384513 51 318009 162567 54 55 56 27356 58 6...
output:
32
result:
wrong answer 1st words differ - expected: '693', found: '32'
Subtask #3:
score: 0
Wrong Answer
Test #36:
score: 0
Wrong Answer
time: 0ms
memory: 8028kb
input:
1992 25 144 612 1315 1966 1779 1773 1529 625 36 1849 1783 1441 1388 1558 1258 724 137 397 542 353 1162 1213 406 792 1317 882 994 298 1864 1969 103 449 508 1501 89 1721 195 778 657 222 1152 1780 613 743 1206 694 829 142 69 1973 1465 1343 655 1540 155 146 350 491 759 1695 1082 1357 1329 1745 232 1850 ...
output:
18
result:
wrong answer 1st words differ - expected: '237', found: '18'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #2:
0%