Submission #488045

# Submission time Handle Problem Language Result Execution time Memory
488045 2021-11-17T13:42:42 Z maks007 Trampoline (info1cup20_trampoline) C++14
73 / 100
2000 ms 21560 KB
#include <bits/stdc++.h>
 
using namespace std;
 
void solve() {
	int r, c;
	cin >> r >> c;
	int n;
	cin >> n;
	vector <pair<int, int>> temp;
	map <int, vector <int>> mp;
	for(int i = 0; i < n; i ++) {
		int a, b;
		cin >> a >> b;
		a --;
		b --;
		#define pb push_back
		temp.pb({a, b});
	}
	sort(temp.begin(), temp.end());
	for(int i = 0; i < temp.size(); i ++) {
		mp[temp[i].first].push_back(temp[i].second);
	}
	int T;
	cin >> T;
	while(T --) {
		pair <int, int> start, end;
		cin >> start.first >> start.second >> end.first >> end.second;
		start.first --;
		start.second --;
		end.first --;
		end.second --;
		int x1 = start.first;
		int y1 = start.second;
		int x2 = end.first;
		int y2 = end.second;
		while(x1 != x2) {
			if(mp[x1].empty()) break;
			auto temp = lower_bound(mp[x1].begin(), mp[x1].end(), y1);
			if(temp == mp[x1].end()) break;
			y1 = *temp; x1 ++;
		}
		if(x1 == x2 and y1 <= y2) cout << "Yes\n";
		else cout << "No\n";
	}
}
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int Q = 1;
	//cin >> Q;
	while (Q --) {
		solve();
	}
	return 0;
}

Compilation message

trampoline.cpp: In function 'void solve()':
trampoline.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i = 0; i < temp.size(); i ++) {
      |                 ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 460 KB 200 token(s): yes count is 21, no count is 179
2 Correct 3 ms 460 KB 200 token(s): yes count is 70, no count is 130
3 Correct 3 ms 332 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 98 ms 3280 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 99 ms 5200 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 239 ms 4448 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 527 ms 5204 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Correct 155 ms 3772 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 164 ms 15288 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 175 ms 15052 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 200 ms 15576 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 200 ms 15696 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 264 ms 21560 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Correct 5 ms 332 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 12 ms 712 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 6 ms 1228 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 4 ms 720 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 457 ms 828 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 4 ms 720 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2073 ms 10708 KB Time limit exceeded
2 Halted 0 ms 0 KB -