Submission #1027605

# Submission time Handle Problem Language Result Execution time Memory
1027605 2024-07-19T07:57:19 Z vjudge1 Trampoline (info1cup20_trampoline) C++17
73 / 100
2000 ms 45348 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long lo; 

#define fi first
#define se second
#define endl "\n"
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
#define _ << " " <<

const lo inf = 1000000000;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,a[li],k,flag,t,x[li],y[li],r,c,xs[li],xh[li],ys[li],yh[li];
int cev;
string s;
vector<int> v,vv[li];

int32_t main(void){
	fio();
	cin>>r>>c>>n;
	FOR{
		cin>>x[i]>>y[i];
		v.pb(x[i]);
	}
	cin>>t;
	for(int i=1;i<=t;i++){
		cin>>xs[i]>>ys[i]>>xh[i]>>yh[i];
	}
	sort(v.begin(),v.end());
	int sayac=0;
	map<int,int> mpp;
	for(int i=0;i<(int)v.size();i++){
		if(i==0 || v[i]!=v[i-1]){
			sayac++;
			mpp[v[i]]=sayac;
		}
	}
	for(int i=1;i<=n;i++){
		vv[mpp[x[i]]].pb(y[i]);
	}
	for(int i=1;i<=sayac;i++)sort(vv[i].begin(),vv[i].end());
	for(int i=1;i<=t;i++){
		if(xh[i]-xs[i]>n){cout<<"No\n";continue;}
		while(xs[i]<xh[i]){
			if(ys[i]>yh[i])break;
			if(mpp.find(xs[i])==mpp.end())break;
			int at=mpp[xs[i]];
			int tut=lower_bound(vv[at].begin(),vv[at].end(),ys[i])-vv[at].begin();
			if(tut==(int)vv[at].size())break;
			ys[i]=vv[at][tut];
			xs[i]++;
		}
		if(xs[i]!=xh[i] || ys[i]>yh[i]){cout<<"No\n";continue;}
		cout<<"Yes\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25436 KB 200 token(s): yes count is 21, no count is 179
2 Correct 6 ms 25296 KB 200 token(s): yes count is 70, no count is 130
3 Correct 5 ms 25436 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 72 ms 31684 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 75 ms 31688 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 149 ms 31068 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 237 ms 31816 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Correct 161 ms 40392 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 118 ms 40388 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 123 ms 39964 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 140 ms 40908 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 137 ms 40392 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 211 ms 45076 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Correct 6 ms 25180 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 7 ms 25180 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 7 ms 25776 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 5 ms 25180 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 112 ms 25500 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 5 ms 25176 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2071 ms 45348 KB Time limit exceeded
2 Halted 0 ms 0 KB -