Submission #60020

# Submission time Handle Problem Language Result Execution time Memory
60020 2018-07-23T12:28:29 Z Flugan42 New Home (APIO18_new_home) C++14
5 / 100
5000 ms 13260 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
#define rep(i,a,b) for(int i = a; i < b; i++)
#define per(i,a,b) for(int i = a; i >= b; i--)
#define inf 1000000000000000000
#define sz(x) (ll)(x).size()
#define all(x) x.begin(),x.end()

struct store {
  ll x,a,b,t;
} ;
vector<store> stores;
ll n,q,k,l,y;
store _;
vi type;

int main(){
  cin >> n >> k >> q;
  stores.assign(n,_);
  rep(i,0,n){
    cin >> stores[i].x >> stores[i].t >> stores[i].a >> stores[i].b;
    stores[i].t--;
  }
  rep(i,0,q){
    type.assign(k,-1);
    cin >> l >> y;
    rep(i,0,n){
      ll tp = stores[i].t;
      if (stores[i].a > y || stores[i].b < y) continue;
      if (type[tp] == -1) type[tp] = abs(l-stores[i].x);
      else type[tp] = min(type[tp],abs(l-stores[i].x));
    }
    ll ma = -1;
    rep(i,0,k) {
      if (type[i] == -1) { cout << -1 << endl; break;}
      else ma = max(ma,type[i]);
      if (i == k-1) { cout << ma << endl; }
    }
  }

}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 356 KB Output is correct
5 Correct 7 ms 440 KB Output is correct
6 Correct 5 ms 484 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 6 ms 572 KB Output is correct
9 Correct 7 ms 592 KB Output is correct
10 Correct 7 ms 612 KB Output is correct
11 Correct 7 ms 632 KB Output is correct
12 Correct 6 ms 652 KB Output is correct
13 Correct 5 ms 672 KB Output is correct
14 Correct 4 ms 820 KB Output is correct
15 Correct 8 ms 820 KB Output is correct
16 Correct 7 ms 820 KB Output is correct
17 Correct 7 ms 828 KB Output is correct
18 Correct 8 ms 848 KB Output is correct
19 Correct 6 ms 868 KB Output is correct
20 Correct 6 ms 888 KB Output is correct
21 Correct 6 ms 908 KB Output is correct
22 Correct 6 ms 924 KB Output is correct
23 Correct 5 ms 944 KB Output is correct
24 Correct 7 ms 964 KB Output is correct
25 Correct 7 ms 964 KB Output is correct
26 Correct 5 ms 1004 KB Output is correct
27 Correct 6 ms 1024 KB Output is correct
28 Correct 7 ms 1032 KB Output is correct
29 Correct 6 ms 1052 KB Output is correct
30 Correct 5 ms 1072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 356 KB Output is correct
5 Correct 7 ms 440 KB Output is correct
6 Correct 5 ms 484 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 6 ms 572 KB Output is correct
9 Correct 7 ms 592 KB Output is correct
10 Correct 7 ms 612 KB Output is correct
11 Correct 7 ms 632 KB Output is correct
12 Correct 6 ms 652 KB Output is correct
13 Correct 5 ms 672 KB Output is correct
14 Correct 4 ms 820 KB Output is correct
15 Correct 8 ms 820 KB Output is correct
16 Correct 7 ms 820 KB Output is correct
17 Correct 7 ms 828 KB Output is correct
18 Correct 8 ms 848 KB Output is correct
19 Correct 6 ms 868 KB Output is correct
20 Correct 6 ms 888 KB Output is correct
21 Correct 6 ms 908 KB Output is correct
22 Correct 6 ms 924 KB Output is correct
23 Correct 5 ms 944 KB Output is correct
24 Correct 7 ms 964 KB Output is correct
25 Correct 7 ms 964 KB Output is correct
26 Correct 5 ms 1004 KB Output is correct
27 Correct 6 ms 1024 KB Output is correct
28 Correct 7 ms 1032 KB Output is correct
29 Correct 6 ms 1052 KB Output is correct
30 Correct 5 ms 1072 KB Output is correct
31 Execution timed out 5075 ms 5488 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5064 ms 13260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5011 ms 13260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 356 KB Output is correct
5 Correct 7 ms 440 KB Output is correct
6 Correct 5 ms 484 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 6 ms 572 KB Output is correct
9 Correct 7 ms 592 KB Output is correct
10 Correct 7 ms 612 KB Output is correct
11 Correct 7 ms 632 KB Output is correct
12 Correct 6 ms 652 KB Output is correct
13 Correct 5 ms 672 KB Output is correct
14 Correct 4 ms 820 KB Output is correct
15 Correct 8 ms 820 KB Output is correct
16 Correct 7 ms 820 KB Output is correct
17 Correct 7 ms 828 KB Output is correct
18 Correct 8 ms 848 KB Output is correct
19 Correct 6 ms 868 KB Output is correct
20 Correct 6 ms 888 KB Output is correct
21 Correct 6 ms 908 KB Output is correct
22 Correct 6 ms 924 KB Output is correct
23 Correct 5 ms 944 KB Output is correct
24 Correct 7 ms 964 KB Output is correct
25 Correct 7 ms 964 KB Output is correct
26 Correct 5 ms 1004 KB Output is correct
27 Correct 6 ms 1024 KB Output is correct
28 Correct 7 ms 1032 KB Output is correct
29 Correct 6 ms 1052 KB Output is correct
30 Correct 5 ms 1072 KB Output is correct
31 Execution timed out 5075 ms 5488 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 356 KB Output is correct
5 Correct 7 ms 440 KB Output is correct
6 Correct 5 ms 484 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 6 ms 572 KB Output is correct
9 Correct 7 ms 592 KB Output is correct
10 Correct 7 ms 612 KB Output is correct
11 Correct 7 ms 632 KB Output is correct
12 Correct 6 ms 652 KB Output is correct
13 Correct 5 ms 672 KB Output is correct
14 Correct 4 ms 820 KB Output is correct
15 Correct 8 ms 820 KB Output is correct
16 Correct 7 ms 820 KB Output is correct
17 Correct 7 ms 828 KB Output is correct
18 Correct 8 ms 848 KB Output is correct
19 Correct 6 ms 868 KB Output is correct
20 Correct 6 ms 888 KB Output is correct
21 Correct 6 ms 908 KB Output is correct
22 Correct 6 ms 924 KB Output is correct
23 Correct 5 ms 944 KB Output is correct
24 Correct 7 ms 964 KB Output is correct
25 Correct 7 ms 964 KB Output is correct
26 Correct 5 ms 1004 KB Output is correct
27 Correct 6 ms 1024 KB Output is correct
28 Correct 7 ms 1032 KB Output is correct
29 Correct 6 ms 1052 KB Output is correct
30 Correct 5 ms 1072 KB Output is correct
31 Execution timed out 5075 ms 5488 KB Time limit exceeded
32 Halted 0 ms 0 KB -