Submission #982325

# Submission time Handle Problem Language Result Execution time Memory
982325 2024-05-14T06:39:09 Z Sir_Ahmed_Imran New Home (APIO18_new_home) C++17
12 / 100
3387 ms 63912 KB
                              ///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 60000
#define K 401
int t[N];
int x[N];
int l[N];
int ans[N];
set<int> s;
multiset<int> c[K];
map<int,vector<int>> a;
map<int,vector<int>> b;
map<int,vector<int>> Q;
void solve(){
    int n,m,k,p,q,r;
    cin>>n>>k>>m;
    for(int i=1;i<=k;i++){
        c[i].add(-1e9);
        c[i].add(1e9);
    }
    for(int i=0;i<n;i++){
        cin>>x[i]>>t[i]>>p>>q;
        a[p].append(i);
        b[q].append(i);
        s.add(p);
        s.add(q);
    }
    for(int i=0;i<m;i++){
        cin>>l[i]>>p;
        Q[p].append(i);
        s.add(p);
    }
    for(auto& i:s){
        for(auto& j:a[i])
            c[t[j]].add(x[j]);
        for(auto& j:Q[i]){
            r=-1;
            for(int z=1;z<=k;z++){
                p=*(--c[z].lower_bound(l[j]));
                q=*c[z].lower_bound(l[j]);
                p=min(l[j]-p,q-l[j]);
                r=max(p,r); 
            }
            if(r>1e8) r=-1;
            ans[j]=r;
        }
        for(auto& j:b[i])
            c[t[j]].erase(c[t[j]].find(x[j]));
    }
    for(int i=0;i<m;i++)
        cout<<ans[i]<<nl;
}
int terminator(){
    L0TA;
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 484 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 476 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 3 ms 860 KB Output is correct
8 Correct 2 ms 888 KB Output is correct
9 Correct 3 ms 856 KB Output is correct
10 Correct 2 ms 676 KB Output is correct
11 Correct 2 ms 868 KB Output is correct
12 Correct 2 ms 860 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 860 KB Output is correct
15 Correct 2 ms 676 KB Output is correct
16 Correct 2 ms 860 KB Output is correct
17 Correct 2 ms 860 KB Output is correct
18 Correct 2 ms 860 KB Output is correct
19 Correct 2 ms 860 KB Output is correct
20 Correct 2 ms 1112 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 856 KB Output is correct
23 Correct 3 ms 860 KB Output is correct
24 Correct 2 ms 784 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 2 ms 860 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 1 ms 1112 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 484 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 476 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 3 ms 860 KB Output is correct
8 Correct 2 ms 888 KB Output is correct
9 Correct 3 ms 856 KB Output is correct
10 Correct 2 ms 676 KB Output is correct
11 Correct 2 ms 868 KB Output is correct
12 Correct 2 ms 860 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 860 KB Output is correct
15 Correct 2 ms 676 KB Output is correct
16 Correct 2 ms 860 KB Output is correct
17 Correct 2 ms 860 KB Output is correct
18 Correct 2 ms 860 KB Output is correct
19 Correct 2 ms 860 KB Output is correct
20 Correct 2 ms 1112 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 856 KB Output is correct
23 Correct 3 ms 860 KB Output is correct
24 Correct 2 ms 784 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 2 ms 860 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 1 ms 1112 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 3387 ms 63912 KB Output is correct
32 Correct 69 ms 4416 KB Output is correct
33 Correct 518 ms 61772 KB Output is correct
34 Correct 2576 ms 61952 KB Output is correct
35 Correct 1669 ms 63900 KB Output is correct
36 Correct 588 ms 63748 KB Output is correct
37 Correct 423 ms 61008 KB Output is correct
38 Correct 340 ms 61140 KB Output is correct
39 Correct 281 ms 60832 KB Output is correct
40 Correct 285 ms 60980 KB Output is correct
41 Correct 622 ms 61124 KB Output is correct
42 Correct 694 ms 61008 KB Output is correct
43 Correct 342 ms 7716 KB Output is correct
44 Correct 533 ms 61012 KB Output is correct
45 Correct 369 ms 61012 KB Output is correct
46 Correct 276 ms 61096 KB Output is correct
47 Correct 217 ms 58976 KB Output is correct
48 Correct 247 ms 58448 KB Output is correct
49 Correct 251 ms 59612 KB Output is correct
50 Correct 447 ms 60612 KB Output is correct
51 Correct 237 ms 59524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 6236 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 2140 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 484 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 476 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 3 ms 860 KB Output is correct
8 Correct 2 ms 888 KB Output is correct
9 Correct 3 ms 856 KB Output is correct
10 Correct 2 ms 676 KB Output is correct
11 Correct 2 ms 868 KB Output is correct
12 Correct 2 ms 860 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 860 KB Output is correct
15 Correct 2 ms 676 KB Output is correct
16 Correct 2 ms 860 KB Output is correct
17 Correct 2 ms 860 KB Output is correct
18 Correct 2 ms 860 KB Output is correct
19 Correct 2 ms 860 KB Output is correct
20 Correct 2 ms 1112 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 856 KB Output is correct
23 Correct 3 ms 860 KB Output is correct
24 Correct 2 ms 784 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 2 ms 860 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 1 ms 1112 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 3387 ms 63912 KB Output is correct
32 Correct 69 ms 4416 KB Output is correct
33 Correct 518 ms 61772 KB Output is correct
34 Correct 2576 ms 61952 KB Output is correct
35 Correct 1669 ms 63900 KB Output is correct
36 Correct 588 ms 63748 KB Output is correct
37 Correct 423 ms 61008 KB Output is correct
38 Correct 340 ms 61140 KB Output is correct
39 Correct 281 ms 60832 KB Output is correct
40 Correct 285 ms 60980 KB Output is correct
41 Correct 622 ms 61124 KB Output is correct
42 Correct 694 ms 61008 KB Output is correct
43 Correct 342 ms 7716 KB Output is correct
44 Correct 533 ms 61012 KB Output is correct
45 Correct 369 ms 61012 KB Output is correct
46 Correct 276 ms 61096 KB Output is correct
47 Correct 217 ms 58976 KB Output is correct
48 Correct 247 ms 58448 KB Output is correct
49 Correct 251 ms 59612 KB Output is correct
50 Correct 447 ms 60612 KB Output is correct
51 Correct 237 ms 59524 KB Output is correct
52 Runtime error 5 ms 6236 KB Execution killed with signal 11
53 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 484 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 476 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 3 ms 860 KB Output is correct
8 Correct 2 ms 888 KB Output is correct
9 Correct 3 ms 856 KB Output is correct
10 Correct 2 ms 676 KB Output is correct
11 Correct 2 ms 868 KB Output is correct
12 Correct 2 ms 860 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 860 KB Output is correct
15 Correct 2 ms 676 KB Output is correct
16 Correct 2 ms 860 KB Output is correct
17 Correct 2 ms 860 KB Output is correct
18 Correct 2 ms 860 KB Output is correct
19 Correct 2 ms 860 KB Output is correct
20 Correct 2 ms 1112 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 856 KB Output is correct
23 Correct 3 ms 860 KB Output is correct
24 Correct 2 ms 784 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 2 ms 860 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 1 ms 1112 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 3387 ms 63912 KB Output is correct
32 Correct 69 ms 4416 KB Output is correct
33 Correct 518 ms 61772 KB Output is correct
34 Correct 2576 ms 61952 KB Output is correct
35 Correct 1669 ms 63900 KB Output is correct
36 Correct 588 ms 63748 KB Output is correct
37 Correct 423 ms 61008 KB Output is correct
38 Correct 340 ms 61140 KB Output is correct
39 Correct 281 ms 60832 KB Output is correct
40 Correct 285 ms 60980 KB Output is correct
41 Correct 622 ms 61124 KB Output is correct
42 Correct 694 ms 61008 KB Output is correct
43 Correct 342 ms 7716 KB Output is correct
44 Correct 533 ms 61012 KB Output is correct
45 Correct 369 ms 61012 KB Output is correct
46 Correct 276 ms 61096 KB Output is correct
47 Correct 217 ms 58976 KB Output is correct
48 Correct 247 ms 58448 KB Output is correct
49 Correct 251 ms 59612 KB Output is correct
50 Correct 447 ms 60612 KB Output is correct
51 Correct 237 ms 59524 KB Output is correct
52 Runtime error 5 ms 6236 KB Execution killed with signal 11
53 Halted 0 ms 0 KB -