답안 #523874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523874 2022-02-08T10:24:48 Z iskhakkutbilim Trampoline (info1cup20_trampoline) C++14
53 / 100
2000 ms 18432 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;
	 map<int, vector<int> > g;
	 for(int i = 0;i < n; i++){
	 	int x, y; 
	 	cin >> x >> y;
	 	st.insert({x, y});
	 }		 
	 for(auto it : st){
	 	g[it.ff].push_back(it.ss);
	 }
     int T;
     cin >> T;
     while(T--){
     	pair<int, int> start;
     	cin >> start.ff >> start.ss;
     	pair<int, int> end;
     	cin >> end.ff >> end.ss;
     	int x, y;
     	// 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;
     	// }
     	x = start.ff;
 		y = start.ss;
 		while(x != end.ff and x <= r and y <= c){
 			int L = lower_bound(g[x].begin(), g[x].end(), y) - g[x].begin();
 			if(L >= g[x].size()) break;
 			y = g[x][L];
 			x++;
 			if(y >= end.ss) break;
 			
 		}
 		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 'int main()':
trampoline.cpp:67:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |     if(L >= g[x].size()) break;
      |        ~~^~~~~~~~~~~~~~
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 4 ms 716 KB 200 token(s): yes count is 21, no count is 179
2 Correct 6 ms 856 KB 200 token(s): yes count is 70, no count is 130
3 Correct 4 ms 588 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 169 ms 11200 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 173 ms 11064 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 373 ms 10684 KB 4000 token(s): yes count is 4000, no count is 0
4 Incorrect 549 ms 11280 KB expected YES, found NO [544th token]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 251 ms 11344 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 264 ms 11308 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 261 ms 11328 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 299 ms 11640 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 313 ms 11620 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 382 ms 17776 KB 200000 token(s): yes count is 97163, no count is 102837
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 588 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 13 ms 600 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 10 ms 1100 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 5 ms 588 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 480 ms 732 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 5 ms 588 KB 5000 token(s): yes count is 3390, no count is 1610
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2078 ms 18432 KB Time limit exceeded
2 Halted 0 ms 0 KB -