답안 #488038

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
488038 2021-11-17T13:18:07 Z maks007 Trampoline (info1cup20_trampoline) C++14
0 / 100
394 ms 54648 KB
#include <bits/stdc++.h>
 
using namespace std;
 
void solve() {
	int r, c;
	cin >> r >> c;
	int n;
	cin >> n;
	map <int, int> mpx, mpy;
	set <int> xs, xy;
	for(int i = 0; i < n; i ++) {
		int a, b;
		cin >> a >> b;
		a --;
		b --;
		#define pb push_back
		xs.insert(a);
		xy.insert(b);
		mpx[a] = b;
		mpy[b] = a;
	}
	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 --;
		if(start.first == end.first) {
			cout << "Yes\n";
			continue;
		}
		vector <int> ans;
		int temp = start.second;
		for(int i = start.first; i < end.first; i ++) {
			if(xs.count(i) == 0) {
			//	cout << i << " ";
				cout << "No\n";
				goto endf;
			}
 		
		}
		for(int i = start.first; i < end.first; i ++ ) {
			#define pb push_back
			ans.pb(mpx[i]);
		}
		if(ans[0] < start.second or ans[0] > end.second) {
			cout << "No\n";
			goto endf;
		}

		for(int i = 1; i < ans.size(); i ++) {
			if(ans[i] < ans[i - 1]) {
				cout << "No\n";
				goto endf;
			}
			if(ans[i] < start.second or ans[i] > end.second) {
				cout << "No\n";
				goto endf;
			}
		}
		cout << "Yes\n";


		endf:;
	}
}
 
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:55:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |   for(int i = 1; i < ans.size(); i ++) {
      |                  ~~^~~~~~~~~~~~
trampoline.cpp:37:7: warning: unused variable 'temp' [-Wunused-variable]
   37 |   int temp = start.second;
      |       ^~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 394 ms 800 KB expected YES, found NO [3rd token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 303 ms 19724 KB expected YES, found NO [4th token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1356 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 387 ms 54648 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -