답안 #287205

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
287205 2020-08-31T13:36:52 Z ScarletS 새 집 (APIO18_new_home) C++17
5 / 100
5000 ms 15888 KB
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size();
using namespace std;

const int MAXN=3e5+7;
int n,k,x,y,cur,ans,INF=1e9,a[MAXN][4];
vector<int> present[MAXN];

ll solve()
{
	ans=0;
	cin>>x>>y;
	for (int i=1;i<=k;++i)
		present[i].clear();
	for (int i=0;i<n;++i)
		if (a[i][2]<=y&&y<=a[i][3])
			present[a[i][1]].push_back(a[i][0]);
	for (int i=1;i<=k;++i)
	{
		if (present[i].empty())
			return -1;
		cur=INF;
		for (int j : present[i])
			cur=min(cur,abs(j-x));
		//cout<<cur<<"\n";
		ans=max(cur,ans);
	}
	return ans;
}

int main()
{
	int q;
	cin>>n>>k>>q;
	for (int i=0;i<n;++i)
		for (int j=0;j<4;++j)
			cin>>a[i][j];
	while (q--)
		cout<<solve()<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7424 KB Output is correct
2 Correct 6 ms 7424 KB Output is correct
3 Correct 5 ms 7424 KB Output is correct
4 Correct 5 ms 7424 KB Output is correct
5 Correct 8 ms 7424 KB Output is correct
6 Correct 9 ms 7424 KB Output is correct
7 Correct 9 ms 7424 KB Output is correct
8 Correct 9 ms 7424 KB Output is correct
9 Correct 9 ms 7424 KB Output is correct
10 Correct 9 ms 7424 KB Output is correct
11 Correct 8 ms 7424 KB Output is correct
12 Correct 8 ms 7424 KB Output is correct
13 Correct 8 ms 7424 KB Output is correct
14 Correct 8 ms 7424 KB Output is correct
15 Correct 9 ms 7424 KB Output is correct
16 Correct 9 ms 7424 KB Output is correct
17 Correct 8 ms 7424 KB Output is correct
18 Correct 9 ms 7424 KB Output is correct
19 Correct 9 ms 7424 KB Output is correct
20 Correct 8 ms 7424 KB Output is correct
21 Correct 10 ms 7424 KB Output is correct
22 Correct 9 ms 7424 KB Output is correct
23 Correct 9 ms 7424 KB Output is correct
24 Correct 9 ms 7424 KB Output is correct
25 Correct 9 ms 7424 KB Output is correct
26 Correct 8 ms 7424 KB Output is correct
27 Correct 8 ms 7424 KB Output is correct
28 Correct 8 ms 7424 KB Output is correct
29 Correct 8 ms 7424 KB Output is correct
30 Correct 8 ms 7424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7424 KB Output is correct
2 Correct 6 ms 7424 KB Output is correct
3 Correct 5 ms 7424 KB Output is correct
4 Correct 5 ms 7424 KB Output is correct
5 Correct 8 ms 7424 KB Output is correct
6 Correct 9 ms 7424 KB Output is correct
7 Correct 9 ms 7424 KB Output is correct
8 Correct 9 ms 7424 KB Output is correct
9 Correct 9 ms 7424 KB Output is correct
10 Correct 9 ms 7424 KB Output is correct
11 Correct 8 ms 7424 KB Output is correct
12 Correct 8 ms 7424 KB Output is correct
13 Correct 8 ms 7424 KB Output is correct
14 Correct 8 ms 7424 KB Output is correct
15 Correct 9 ms 7424 KB Output is correct
16 Correct 9 ms 7424 KB Output is correct
17 Correct 8 ms 7424 KB Output is correct
18 Correct 9 ms 7424 KB Output is correct
19 Correct 9 ms 7424 KB Output is correct
20 Correct 8 ms 7424 KB Output is correct
21 Correct 10 ms 7424 KB Output is correct
22 Correct 9 ms 7424 KB Output is correct
23 Correct 9 ms 7424 KB Output is correct
24 Correct 9 ms 7424 KB Output is correct
25 Correct 9 ms 7424 KB Output is correct
26 Correct 8 ms 7424 KB Output is correct
27 Correct 8 ms 7424 KB Output is correct
28 Correct 8 ms 7424 KB Output is correct
29 Correct 8 ms 7424 KB Output is correct
30 Correct 8 ms 7424 KB Output is correct
31 Execution timed out 5054 ms 11336 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5009 ms 15888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5050 ms 14848 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7424 KB Output is correct
2 Correct 6 ms 7424 KB Output is correct
3 Correct 5 ms 7424 KB Output is correct
4 Correct 5 ms 7424 KB Output is correct
5 Correct 8 ms 7424 KB Output is correct
6 Correct 9 ms 7424 KB Output is correct
7 Correct 9 ms 7424 KB Output is correct
8 Correct 9 ms 7424 KB Output is correct
9 Correct 9 ms 7424 KB Output is correct
10 Correct 9 ms 7424 KB Output is correct
11 Correct 8 ms 7424 KB Output is correct
12 Correct 8 ms 7424 KB Output is correct
13 Correct 8 ms 7424 KB Output is correct
14 Correct 8 ms 7424 KB Output is correct
15 Correct 9 ms 7424 KB Output is correct
16 Correct 9 ms 7424 KB Output is correct
17 Correct 8 ms 7424 KB Output is correct
18 Correct 9 ms 7424 KB Output is correct
19 Correct 9 ms 7424 KB Output is correct
20 Correct 8 ms 7424 KB Output is correct
21 Correct 10 ms 7424 KB Output is correct
22 Correct 9 ms 7424 KB Output is correct
23 Correct 9 ms 7424 KB Output is correct
24 Correct 9 ms 7424 KB Output is correct
25 Correct 9 ms 7424 KB Output is correct
26 Correct 8 ms 7424 KB Output is correct
27 Correct 8 ms 7424 KB Output is correct
28 Correct 8 ms 7424 KB Output is correct
29 Correct 8 ms 7424 KB Output is correct
30 Correct 8 ms 7424 KB Output is correct
31 Execution timed out 5054 ms 11336 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7424 KB Output is correct
2 Correct 6 ms 7424 KB Output is correct
3 Correct 5 ms 7424 KB Output is correct
4 Correct 5 ms 7424 KB Output is correct
5 Correct 8 ms 7424 KB Output is correct
6 Correct 9 ms 7424 KB Output is correct
7 Correct 9 ms 7424 KB Output is correct
8 Correct 9 ms 7424 KB Output is correct
9 Correct 9 ms 7424 KB Output is correct
10 Correct 9 ms 7424 KB Output is correct
11 Correct 8 ms 7424 KB Output is correct
12 Correct 8 ms 7424 KB Output is correct
13 Correct 8 ms 7424 KB Output is correct
14 Correct 8 ms 7424 KB Output is correct
15 Correct 9 ms 7424 KB Output is correct
16 Correct 9 ms 7424 KB Output is correct
17 Correct 8 ms 7424 KB Output is correct
18 Correct 9 ms 7424 KB Output is correct
19 Correct 9 ms 7424 KB Output is correct
20 Correct 8 ms 7424 KB Output is correct
21 Correct 10 ms 7424 KB Output is correct
22 Correct 9 ms 7424 KB Output is correct
23 Correct 9 ms 7424 KB Output is correct
24 Correct 9 ms 7424 KB Output is correct
25 Correct 9 ms 7424 KB Output is correct
26 Correct 8 ms 7424 KB Output is correct
27 Correct 8 ms 7424 KB Output is correct
28 Correct 8 ms 7424 KB Output is correct
29 Correct 8 ms 7424 KB Output is correct
30 Correct 8 ms 7424 KB Output is correct
31 Execution timed out 5054 ms 11336 KB Time limit exceeded
32 Halted 0 ms 0 KB -