답안 #532823

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
532823 2022-03-04T03:07:58 Z hhhhaura Trampoline (info1cup20_trampoline) C++14
73 / 100
2000 ms 35468 KB
#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define ceil(a, b) ((a + b - 1) / (b))
#define all(x) x.begin(), x.end()
#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)

#ifdef wiwihorz
#define print(a...) cerr<<"Line "<<__LINE__<<":",kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L)==R], ++L;}
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...);} 
#else
#define print(...) 0
#define vprint(...) 0
#endif
namespace solver {
	int r, c, n, ii;
	vector<set<int>> s;
	map<int, int> mp;
	void init_(int _r, int _c, int _n) {
		r = _r, c = _c;
		n = _n, ii = 0;
		s.assign(n + 1, set<int>());
		mp.clear();
	}
	void solve() {
		rep(i, 1, n) {
			int x, y; 
			cin >> x >> y;
			if(mp.find(x) == mp.end()) mp[x] = ++ii;
			s[mp[x]].insert(y);
		}
		int t; cin >> t;
		while(t--) {
			int x, y, x1, y1;
			cin >> x >> y;
			cin >> x1 >> y1;
			if(x > x1 || y > y1) cout << "No\n";
			else if(x1 - x > n) cout << "No\n";
			else {
				int cur = y1, ans = 1;
				rrep(i, x, x1 - 1) {
					if(mp.find(i) == mp.end()) {
						ans = 0;
						break;
					}
					int id = mp[i];
					auto it = s[id].upper_bound(cur);
					if(it == s[id].begin()) {
						ans = 0;
						break;
					}
					it = prev(it);
					cur = *it;
				}
				if(ans && cur >= y) cout << "Yes\n";
				else cout << "No\n";
			}
		}
	}
	
};
using namespace solver;
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	int r, c, n;
	cin >> r >> c >> n;
	init_(r, c, n);
	solve();
	return 0;
}

Compilation message

trampoline.cpp:5: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
    5 | #pragma loop-opt(on)
      | 
trampoline.cpp:21:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   21 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L)==R], ++L;}
      |             ^~~~
trampoline.cpp:21:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   21 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L)==R], ++L;}
      |                     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1224 KB 200 token(s): yes count is 21, no count is 179
2 Correct 6 ms 1348 KB 200 token(s): yes count is 70, no count is 130
3 Correct 4 ms 960 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 263 ms 21100 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 243 ms 21100 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 593 ms 20668 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 838 ms 21116 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 31564 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 278 ms 31416 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 334 ms 31320 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 388 ms 31556 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 377 ms 31560 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 481 ms 35468 KB 200000 token(s): yes count is 97163, no count is 102837
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1088 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 15 ms 1052 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 8 ms 1356 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 6 ms 1096 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 165 ms 1160 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 5 ms 1092 KB 5000 token(s): yes count is 3390, no count is 1610
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2075 ms 28264 KB Time limit exceeded
2 Halted 0 ms 0 KB -