Submission #260896

# Submission time Handle Problem Language Result Execution time Memory
260896 2020-08-11T07:16:18 Z 최은수(#5044) Sweeping (JOI20_sweeping) C++17
11 / 100
943 ms 27928 KB
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
struct fen
{
    int t[500010];
    inline void upd(int n,int x,int p)
    {
        for(;x<=n;x+=x&-x)
            if(t[x]<p)
                t[x]=p;
        return;
    }
    inline int query(int x)
    {
        int ans=0;
        for(;x>0;x^=x&-x)
            if(ans<t[x])
                ans=t[x];
        return ans;
    }
}f1,f2;
int pct;
int when[1500010];
pi pos[1500010];
int typ[1000010],len[1000010];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,m,q;
    cin>>n>>m>>q;
    pct=m;
    for(int i=0;i++<m;)
    {
        cin>>pos[i].fi>>pos[i].se;
        f1.upd(m,i,pos[i].fi);
        f2.upd(m,m+1-i,pos[i].se);
    }
    for(int i=0;i++<q;)
    {
        cin>>typ[i]>>len[i];
        if(typ[i]==1)
        {
            cout<<f1.query(len[i])<<' '<<f2.query(m+1-len[i])<<'\n';
        }
        else if(typ[i]==2)
        {
            if(f2.query(1)>len[i])
                continue;
            int s=1,e=m;
            while(s<e)
            {
                int md=s+(e-s)/2;
                if(f2.query(m+1-md)<=len[i])
                    e=md;
                else
                    s=md+1;
            }
            f1.upd(m,s,n-len[i]);
        }
        else if(typ[i]==3)
        {
            if(f1.query(1)>len[i])
                continue;
            int s=1,e=m;
            while(s<e)
            {
                int md=s+(e-s+1)/2;
                if(f1.query(md)<=len[i])
                    s=md;
                else
                    e=md-1;
            }
            f2.upd(m,m+1-s,n-len[i]);
        }
        else
        {
        }
    }
    cout.flush();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 223 ms 17656 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 910 ms 27928 KB Output is correct
2 Correct 943 ms 26700 KB Output is correct
3 Correct 807 ms 26040 KB Output is correct
4 Correct 807 ms 26872 KB Output is correct
5 Correct 919 ms 26500 KB Output is correct
6 Correct 891 ms 26484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 910 ms 27928 KB Output is correct
2 Correct 943 ms 26700 KB Output is correct
3 Correct 807 ms 26040 KB Output is correct
4 Correct 807 ms 26872 KB Output is correct
5 Correct 919 ms 26500 KB Output is correct
6 Correct 891 ms 26484 KB Output is correct
7 Incorrect 737 ms 26656 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -