답안 #1040075

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040075 2024-07-31T15:46:06 Z hotboy2703 청소 (JOI20_sweeping) C++17
1 / 100
18000 ms 82612 KB
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))
const ll INF = 1e18;
const ll MAXN = 1.5e6+100;
struct query{
    ll t,p,x,y;
};
pll a[MAXN];
ll val[MAXN*2];
ll dsu[MAXN*2];
ll side[MAXN*2];
vector <ll> comp[MAXN*2];

ll n,m,q;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(nullptr);
    cin>>n>>m>>q;
    vector <query> all;
    ll ptr = 0;
    for (ll i = 1;i <= m;i ++){
        ll x,y;
        cin>>x>>y;
        a[++ptr] = MP(x,y);
    }
    ll cnt=0;
    for (ll i = 1;i <= q;i ++){
        ll t;
        cin>>t;
        if (t==1){
            ll p;
            cin>>p;
            cout<<a[p].fi<<' '<<a[p].se<<'\n';
        }
        if (t==2){
            ll x;
            cin>>x;
            for (ll j = 1;j <= ptr;j ++){
                if (a[j].se <= x)a[j].fi = max(a[j].fi,n-x);
            }
            // all.push_back({2,-1,x,-1});
        }
        if (t==3){
            ll x;
            cin>>x;
            for (ll j = 1;j <= ptr;j ++){
                if (a[j].fi <= x)a[j].se = max(a[j].se,n-x);
            }
            // all.push_back({3,-1,x,-1});
        }
        if (t==4){
            ll x,y;
            cin>>x>>y;
            a[++ptr] = MP(x,y);
        }
    }
    // dnc(0,n,all);
    // for (ll i = 1;i <= cnt;i ++)cout<<ans[i].fi<<' '<<ans[i].se<<'\n';
    return 0;
}

Compilation message

sweeping.cpp: In function 'int main()':
sweeping.cpp:33:8: warning: unused variable 'cnt' [-Wunused-variable]
   33 |     ll cnt=0;
      |        ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 74328 KB Output is correct
2 Correct 13 ms 74664 KB Output is correct
3 Correct 11 ms 74588 KB Output is correct
4 Correct 18 ms 74464 KB Output is correct
5 Correct 23 ms 74568 KB Output is correct
6 Correct 13 ms 74332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18040 ms 81752 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18023 ms 82612 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18023 ms 82612 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 74328 KB Output is correct
2 Correct 13 ms 74664 KB Output is correct
3 Correct 11 ms 74588 KB Output is correct
4 Correct 18 ms 74464 KB Output is correct
5 Correct 23 ms 74568 KB Output is correct
6 Correct 13 ms 74332 KB Output is correct
7 Execution timed out 18040 ms 81752 KB Time limit exceeded
8 Halted 0 ms 0 KB -