답안 #524691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
524691 2022-02-09T19:42:30 Z gagik_2007 Trampoline (info1cup20_trampoline) C++17
73 / 100
2000 ms 17664 KB
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <limits>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unordered_multiset<ll> whydoweneedunorderedmultiset;

#define ff first
#define ss second
#define esle else

ll ttt;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll N = 9;
ll l, r, k, n, m;
map<ll, set<ll>>g;

int main() {
	cin >> k >> m >> n;
	for (int i = 0; i < n; i++) {
		ll x, y;
		cin >> x >> y;
		g[x].insert(y);
	}
	cin >> ttt; 
	while (ttt--) {
		ll xs, ys, xe, ye;
		cin >> xs >> ys >> xe >> ye;
		if (xs == xe && ys <= ye) {
			cout << "YES" << endl;
		}
		else if (xs > xe || ys > ye) {
			cout << "NO" << endl;
		}
		else {
			ll cur_y = ys;
			ll cur_x = xs;
			bool ok = true;
			while (cur_x != xe && cur_y <= ye) {
				auto it = g[cur_x].lower_bound(cur_y);
				if (it == g[cur_x].end()) {
					ok = false;
					break;
				}
				else { 
					cur_y = *it;
				}
				cur_x++;
			}
			ok = ok && (cur_y <= ye);
			if (ok) {
				cout << "YES" << endl;
			}
			else cout << "NO" << endl;
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 716 KB 200 token(s): yes count is 21, no count is 179
2 Correct 6 ms 844 KB 200 token(s): yes count is 70, no count is 130
3 Correct 5 ms 588 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 246 ms 10396 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 248 ms 10324 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 531 ms 10300 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 580 ms 10348 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Correct 829 ms 11008 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 839 ms 11088 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 819 ms 10948 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 869 ms 11080 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 857 ms 11084 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 932 ms 17160 KB 200000 token(s): yes count is 97163, no count is 102837
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 816 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 23 ms 844 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 20 ms 1228 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 22 ms 844 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 206 ms 948 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 19 ms 716 KB 5000 token(s): yes count is 3390, no count is 1610
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2080 ms 17664 KB Time limit exceeded
2 Halted 0 ms 0 KB -