Submission #250896

# Submission time Handle Problem Language Result Execution time Memory
250896 2020-07-19T11:14:19 Z akarinkof Strange Device (APIO19_strange_device) C++14
0 / 100
184 ms 2040 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 mi=0;
		ll z=0;
		rep(j,n){
			if(a[j]<=y[i]&&y[i]<=b[j]){
				if(f[t[j]]==0){
					f[t[j]]=1;
					z++;
				}
				mi=max(mi,abs(x[j]-l[i]));
			}
		}
		if(z!=k)cout<<"-1"<<endl;
		else cout<<mi<<endl;
	}

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1536 KB Output is correct
2 Incorrect 184 ms 2040 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1536 KB Output is correct
2 Incorrect 184 ms 2040 KB Output isn't correct
3 Halted 0 ms 0 KB -