답안 #523800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523800 2022-02-08T07:50:29 Z iskhakkutbilim Trampoline (info1cup20_trampoline) C++14
43 / 100
2000 ms 21072 KB
// Author: Tazhibaev Iskhak
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<int, int> ,null_type,less< pair<int, int> >,rb_tree_tag,
	tree_order_statistics_node_update> ordered_set;
const long double pi = acos((long double) - 1.0);
const double eps = (double)1e-9;
const int INF = 1e9 + 7;
    #define ff         first
    #define ss         second
    #define ll         long long
    #define ld		   long double
    #define pb         push_back
void usaco( string filename){
  freopen((filename+".in").c_str(), "r", stdin);
  freopen((filename+".out").c_str(), "w", stdout);
}
int r, c, n;

int in(int i, int j){
	if(i >= 1 and i <= r and j >= 1 and j <= c) return 1;
			return 0;
}


main(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(nullptr); cout.tie(nullptr);
	 cin >> r >> c >> n;
	 set< pair<int, int> > st;
	 set< pair<int, int> > idx;
	 for(int i = 0;i < n; i++){
	 	int x, y; 
	 	cin >> x >> y;
	 	st.insert({x, y});
	 	idx.insert({y, x});
	 }		 
     int T;
     cin >> T;
     while(T--){
     	pair<int, int> start;
     	cin >> start.ff >> start.ss;
     	pair<int, int> end;
     	cin >> end.ff >> end.ss;
     	
     	if(end.ff == start.ff and end.ss >= end.ff){
     		cout << "Yes" << "\n";
     		continue;
     	}else if(end.ff < start.ff ){
     		cout << "No" << "\n";
     		continue;
     	}else if(end.ss < start.ss){
     		cout << "No" << "\n";
     		continue;
     	}
     	int x = start.ff;
     	int y = start.ss;
 		while(x != end.ff){
 			if(y == c) break;
 			if(y > end.ss) break;
 			if(st.count({x, y})) x++;
 			else y++;
 		}
 		if(x == end.ff and y <= end.ss) cout << "Yes";
 		else cout << "No";
     	cout << "\n";
     }
    return 0;
}

Compilation message

trampoline.cpp:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   31 | main(){
      | ^~~~
trampoline.cpp: In function 'void usaco(std::string)':
trampoline.cpp:20:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |   freopen((filename+".in").c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp:21:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |   freopen((filename+".out").c_str(), "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1100 KB 200 token(s): yes count is 21, no count is 179
2 Correct 8 ms 1196 KB 200 token(s): yes count is 70, no count is 130
3 Correct 6 ms 972 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 490 ms 19404 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 460 ms 21072 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 722 ms 20528 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 757 ms 20880 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2082 ms 19192 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2070 ms 840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2079 ms 19140 KB Time limit exceeded
2 Halted 0 ms 0 KB -