답안 #524683

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
524683 2022-02-09T19:23:07 Z gagik_2007 Trampoline (info1cup20_trampoline) C++17
54 / 100
2000 ms 28292 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) {
			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 7 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 220 ms 9868 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 226 ms 11756 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 519 ms 11256 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 557 ms 11768 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Correct 941 ms 21940 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 820 ms 22124 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 841 ms 21984 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 886 ms 22256 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 856 ms 22160 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 974 ms 28292 KB 200000 token(s): yes count is 97163, no count is 102837
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 840 KB expected NO, found YES [16th token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2079 ms 21128 KB Time limit exceeded
2 Halted 0 ms 0 KB -