답안 #250918

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
250918 2020-07-19T12:18:46 Z akarinkof 새 집 (APIO18_new_home) C++14
0 / 100
5000 ms 11128 KB
#include<bits/stdc++.h>
#include<iostream>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int x,y,sx,sy,cost;
};
ll x[300001],t[300001],a[300001],b[300001];
ll l[300001],y[300001];

int main() {

	ll n,k,q;
	cin>>n>>k>>q;
	rep(i,n)cin>>x[i]>>t[i]>>a[i]>>b[i];
	rep(i,q){
		cin>>l[i]>>y[i];
		int f[300001]={};
		ll ma[300001]={};
		ll mi=0;
		ll z=0;
		rep(j,n){
			if(a[j]<=y[i]&&y[i]<=b[j]){
				if(f[t[j]]==0){
					//ma[t[j]]=abs(x[j]-l[i]);
					f[t[j]]=1;
					z++;
				}
				//ma[t[j]]=min(abs(x[j]-l[i]),ma[t[j]]);
				mi=max(mi,abs(x[j]-l[i]));
			}
		}
		rep(s,k)mi=max(mi,ma[s+1]);
		if(z!=k)cout<<"-1"<<endl;
		else cout<<mi<<endl;
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1536 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Incorrect 2 ms 1536 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1536 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Incorrect 2 ms 1536 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5065 ms 11008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5052 ms 11128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1536 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Incorrect 2 ms 1536 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1536 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Incorrect 2 ms 1536 KB Output isn't correct
5 Halted 0 ms 0 KB -