結果
| 問題 | No.3782 Synchronized Subsequences |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-04 02:19:03 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 803 bytes |
| 記録 | |
| コンパイル時間 | 1,367 ms |
| コンパイル使用メモリ | 190,612 KB |
| 実行使用メモリ | 9,932 KB |
| 最終ジャッジ日時 | 2026-10-30 20:50:12 |
| 合計ジャッジ時間 | 6,437 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | WA * 20 RE * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <atcoder/segtree>
using namespace std;
using ll=long long;
int op(int x,int y){
return max(x,y);
}
int e(){
return 0;
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin>>n;
vector<int> p(n),q(n);
for(int i=0;i<n;i++)cin>>p[i],p[i]--;
for(int i=0;i<n;i++)cin>>q[i],q[i]--;
auto segs=vector(n,atcoder::segtree<int,op,e>(n));
for(int i=0;i<n;i++){
atcoder::segtree<int,op,e> segl(n),segh(n);
vector<int> res(n);
for(int j=0;j<n;j++){
res[j]=max(segl.prod(0,q[j]),segh.prod(q[j]+1,n))+1;
segl.set(q[j],segs[j].prod(0,p[i]));segh.set(q[j],segs[j].prod(p[i]+1,n));
}
for(int j=0;j<n;j++)segs[j].set(p[i],res[j]);
}
int ans=0;
for(int i=0;i<n;i++)ans=max(ans,segs[i].all_prod());
cout<<ans<<endl;
}