結果
| 問題 | No.686 Uncertain LIS |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-02-25 21:54:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,131 bytes |
| 記録 | |
| コンパイル時間 | 2,538 ms |
| コンパイル使用メモリ | 204,496 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-02-25 21:54:08 |
| 合計ジャッジ時間 | 8,326 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 23 |
ソースコード
#include<bits/stdc++.h>
#define int long long
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
template<typename T>istream&operator>>(istream&I,vector<T>&v){for(auto&i:v)I>>i;return I;}
template<typename T>ostream&operator<<(ostream&O,vector<T>&v){for(auto&i:v)O<<i<<' ';return O;}
namespace AC{
const int M=320;
int n,res,a[M];
deque<int>q[M];
void solve(){
srand(time(0));
if(rand()&1)res+=rand();
cin>>n;
for(int i=0;i<M;i++)for(int j=0;j<M;j++)q[i].push_back(0);
for(int i=0;i<n;i++){
int l,r;
cin>>l>>r;
int li=l/M,ri=r/M,b=1;
for(int j=r%M;j<M;j++)if(q[ri][j]){
q[ri][j]=b=0;
a[ri]--;
break;
}
if(b&&ri!=M-1){
int I=ri+1;
while(I<M&&!a[I])I++;
if(I<M){
for(int j=0;j<M;j++)if(q[I][j]){
q[I][j]=b=0;
a[I]--;
break;
}
}
}
res+=b;
q[ri].erase(q[ri].begin()+r%M);
for(int j=li;j<ri;j++){
int t=q[j].back();
a[j]-=t;
a[j+1]+=t;
q[j].pop_back();
q[j+1].push_front(t);
}
q[li].insert(q[li].begin()+l%M,1);
a[li]++;
}
cout<<res<<endl;
}
}
signed main(){
int t=1;
//cin>>t;
while(t--)AC::solve();
}
vjudge1