Submission #522144

# Submission time Handle Problem Language Result Execution time Memory
522144 2022-02-04T00:31:46 Z maks007 Trampoline (info1cup20_trampoline) C++14
73 / 100
2000 ms 21656 KB
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void) {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	map <int,vector <int>> a;
	int q;
	cin >> q;
	vector <pair <int,int>> temp;
	while(q --) {
		int x, y;
		cin >> x >> y;
		x --;
		y --;
		temp.push_back({x, y});
	}
	sort(temp.begin(), temp.end());
	for(int i = 0; i < temp.size(); i ++) {
		a[temp[i].first].push_back(temp[i].second);
	}
	cin >> q;
	while(q --) {
		int startx, starty, endx, endy;
		cin >> startx >> starty >> endx >> endy;
		startx --;
		starty --;
		endx --;
		endy --;
		while(startx != endx) {
			auto it = lower_bound(a[startx].begin(), a[startx].end(), starty);
			if(it == a[startx].end()) {
				goto end;
			}
			startx ++;
			starty = *it;
		}
		if(startx == endx and starty <= endy){
			cout << "Yes\n";
		}else cout << "No\n";
		continue;
		end:;
		cout << "No\n";
	}
	return false;
}

Compilation message

trampoline.cpp: In function 'int main()':
trampoline.cpp:22: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]
   22 |  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 2 ms 332 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 88 ms 3280 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 100 ms 3232 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 215 ms 2908 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 425 ms 3340 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Correct 185 ms 3772 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 172 ms 15284 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 184 ms 15020 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 192 ms 15512 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 207 ms 15456 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 282 ms 21656 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 11 ms 668 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 6 ms 1220 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 5 ms 716 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 336 ms 824 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 5 ms 716 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2097 ms 10696 KB Time limit exceeded
2 Halted 0 ms 0 KB -