QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#748523#190. New HomePioneer0 7ms81528kbC++203.0kb2024-11-14 20:37:432024-11-14 20:37:44

Judging History

你现在查看的是最新测评结果

  • [2024-11-14 20:37:44]
  • 评测
  • 测评结果:0
  • 用时:7ms
  • 内存:81528kb
  • [2024-11-14 20:37:43]
  • 提交

answer

#include <bits/stdc++.h>
 
#pragma GCC optimize("Ofast")
 
#define ll long long
// #define int ll
#define all(v) v.begin(),v.end()
#define sz(s) ((int)s.size())
#define pb push_back
// #define F first
// #define S second
// #define pii pair<int,int>
// #define ppb pop_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
 
const int inf=1e8;
const int MAX=3e5+10;
const int mod=1e9+7;
 
int binpow(int a,int n){
    if(!n)return 1;
    if(n%2==1)return a*binpow(a,n-1)%mod;
    int k=binpow(a,n/2);
    return k*k%mod;
}
 
int n,k,q,m;
int a[MAX],b[MAX],x[MAX],t[MAX];
int l[MAX],y[MAX];
vector<int> events[MAX+MAX+MAX],zap[MAX+MAX+MAX];
multiset<int> st[MAX];
vector<int> tim,pos;
 
struct segtree{
    multiset<int> t[2*2*MAX];
    int mx[2*2*MAX];
 
    segtree(){
        memset(mx,-1,sizeof(mx));
    }
 
    void add(int v,int tl,int tr,int pos,int x){
        pos+=m;
        t[pos].insert(x);
        mx[pos]=*t[pos].rbegin();
        while(pos>1){
            pos/=2;
            mx[pos]=max(mx[2*pos],mx[2*pos+1]);
        }
    }
 
    void del(int v,int tl,int tr,int pos,int x){
        pos+=m;
        t[pos].erase(t[pos].find(x));
        mx[pos]=(t[pos].empty()?-1:*t[pos].rbegin());
        while(pos>1){
            pos/=2;
            mx[pos]=max(mx[2*pos],mx[2*pos+1]);
        }
    }
 
    int get(int v,int tl,int tr,int l,int r){
        l+=m,r+=m+1;
        int res=0;
        while(l<r){
            if(l&1){
                res=max(res,mx[l++]);
            }
            if(r&1){
                res=max(res,mx[--r]);
            }
            l/=2,r/=2;
        }
        return res;
    }
}tree;
 
int cnt[MAX],col;
 
int getx(int x){
    return lb(all(pos),x)-pos.begin();
}
 
void add(int id){
    if(cnt[t[id]]==0)col++;
    cnt[t[id]]++;
    if(st[t[id]].find(x[id])!=st[t[id]].end())st[t[id]].insert(x[id]);
    else{
        auto l=--st[t[id]].lb(x[id]);
        auto r=l;
        r++;
        int LL=getx(*l+1);
        if(!(*l==-1&&*r==inf+1))tree.del(1,0,m-1,LL,*r-1);
        tree.add(1,0,m-1,LL,x[id]-1);
        tree.add(1,0,m-1,getx(x[id]+1),*r-1);
        st[t[id]].insert(x[id]);
    }
}
 
void del(int id){
    id=-id;
    cnt[t[id]]--;
    if(cnt[t[id]]==0)col--;
    st[t[id]].erase(st[t[id]].find(x[id]));
    if(st[t[id]].find(x[id])==st[t[id]].end()){
        auto l=--st[t[id]].lb(x[id]);
        auto r=l;
        r++;
        int LL=getx(*l+1);
        tree.del(1,0,m-1,LL,x[id]-1);
        tree.del(1,0,m-1,getx(x[id]+1),*r-1);
        if(!(*l==-1&&*r==inf+1))tree.add(1,0,m-1,LL,*r-1);
    }
}
 
bool check(int l,int r){
    l=max(l,0);
    r=min(r,inf);
    l=ub(all(pos),l)-pos.begin()-1;
    if(tree.get(1,0,m-1,0,l)>=r)return 0;
    return 1;
}
 
int ans[MAX];
 
void solve(){
    
}
 
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)solve();
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 7ms
memory: 81524kb

input:

4 2 4
3 1 1 10
9 2 2 4
7 2 5 7
4 1 8 10
5 3
5 6
5 9
1 10

output:


result:

wrong answer 1st lines differ - expected: '4', found: ''

Subtask #2:

score: 0
Wrong Answer

Test #34:

score: 0
Wrong Answer
time: 3ms
memory: 81428kb

input:

60000 400 60000
36444793 284 3080519 96564525
76562130 166 22994125 59743695
76399902 168 29694545 59255380
66355790 132 10949454 89347938
40903435 35 29985718 66394219
83300910 368 17240174 54080010
85941830 363 31462093 87304647
73742613 40 29005856 54988711
27852051 29 6132393 88092297
52011498 2...

output:


result:

wrong answer 1st lines differ - expected: '4187955', found: ''

Subtask #3:

score: 0
Wrong Answer

Test #55:

score: 0
Wrong Answer
time: 4ms
memory: 81528kb

input:

300000 60000 300000
52373645 39403 1 100000000
43175904 13875 1 100000000
55098270 40348 1 100000000
69248668 7569 1 100000000
69220659 14654 1 100000000
92585410 38487 1 100000000
41202983 28786 1 100000000
47874378 18728 1 100000000
7254419 14009 1 100000000
94592111 3845 1 100000000
19140558 2773...

output:


result:

wrong answer 1st lines differ - expected: '92572089', found: ''

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%