# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
89609 | 2018-12-17T12:55:15 Z | tjdgus4384 | 새 집 (APIO18_new_home) | C++14 | 5000 ms | 541416 KB |
#include<cstdio> #include<vector> #include<algorithm> #include<set> #include<map> using namespace std; multimap<pair<int, int>, int> m; multiset<int> typeyear[300001]; multiset<int> yearnum; int main(){ int n, q, k, x, t, a, b, l, y; scanf("%d %d %d", &n, &k, &q); for(int i = 0;i < n;i++){ scanf("%d %d %d %d", &x, &t, &a, &b); for(int j = a;j <= b;j++){ if(typeyear[t].count(j) == 0){ yearnum.insert(j); typeyear[t].insert(j); } m.insert({{j, t}, x}); } } for(int i = 0;i < q;i++){ scanf("%d %d", &l, &y); if(yearnum.count(y) < k) printf("-1\n"); else{ int ans = 0; for(int j = 1;j <= k;j++){ x = 1000000000; multimap<pair<int, int>, int>::iterator iter; for(iter = m.find({y, j});iter != m.end();iter++){ if(iter->first != pair<int, int>{y, j}) break; x = min(x, abs(iter->second - l)); } ans = max(ans, x); } printf("%d\n", ans); } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 14456 KB | Output is correct |
2 | Correct | 15 ms | 14564 KB | Output is correct |
3 | Correct | 15 ms | 14564 KB | Output is correct |
4 | Execution timed out | 5075 ms | 538392 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 14456 KB | Output is correct |
2 | Correct | 15 ms | 14564 KB | Output is correct |
3 | Correct | 15 ms | 14564 KB | Output is correct |
4 | Execution timed out | 5075 ms | 538392 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5065 ms | 538392 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5098 ms | 541416 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 14456 KB | Output is correct |
2 | Correct | 15 ms | 14564 KB | Output is correct |
3 | Correct | 15 ms | 14564 KB | Output is correct |
4 | Execution timed out | 5075 ms | 538392 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 14456 KB | Output is correct |
2 | Correct | 15 ms | 14564 KB | Output is correct |
3 | Correct | 15 ms | 14564 KB | Output is correct |
4 | Execution timed out | 5075 ms | 538392 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |