Submission #1010170

# Submission time Handle Problem Language Result Execution time Memory
1010170 2024-06-28T12:21:04 Z LCJLY Trampoline (info1cup20_trampoline) C++14
73 / 100
2000 ms 11364 KB
#include <bits/stdc++.h>
using namespace std;
	
#define int long long 
#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef array<int,3>pi2;

void solve(){	
	int n,m,k;
	cin >> n >> m >> k;
	
	pii arr[k];
	unordered_map<int,vector<int>>mp;
	for(int x=0;x<k;x++){
		cin >> arr[x].first >> arr[x].second;
		mp[arr[x].first].push_back(arr[x].second);
	}
	
	for(auto &it:mp){
		sort(it.second.begin(),it.second.end());
	}
	
	int q;
	cin >> q;
	pii st,ed;
	
	for(int x=0;x<q;x++){
		cin >> st.first >> st.second >> ed.first >> ed.second;
		
		int cur=st.second;
		bool amos=true;
		if(st.first>ed.first) amos=false;
		for(int y=st.first;y<ed.first;y++){
			int index=lower_bound(mp[y].begin(),mp[y].end(),cur)-mp[y].begin();
			if(index>=(int)mp[y].size()){
				amos=false;
				break;
			}
			cur=mp[y][index];
		}
		
		if(amos&&cur<=ed.second){
			cout << "Yes\n";
		}
		else cout << "No\n";
	}

}
 
int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin >> t;
	//freopen("in.txt","w",stdout);
	while(t--){
		solve();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB 200 token(s): yes count is 21, no count is 179
2 Correct 3 ms 732 KB 200 token(s): yes count is 70, no count is 130
3 Correct 1 ms 668 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 48 ms 6492 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 46 ms 6476 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 85 ms 5724 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 136 ms 6572 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Correct 114 ms 6340 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 113 ms 6008 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 116 ms 6224 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 103 ms 6736 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 111 ms 6828 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 123 ms 11356 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Correct 4 ms 604 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 6 ms 912 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 4 ms 1116 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 3 ms 860 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 55 ms 1004 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 3 ms 860 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2070 ms 11364 KB Time limit exceeded
2 Halted 0 ms 0 KB -