답안 #693348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
693348 2023-02-02T21:29:13 Z Ahmed_Solyman Trampoline (info1cup20_trampoline) C++14
30 / 100
2000 ms 28236 KB
#include <bits/stdc++.h>
#include <ext/rope>
 
using namespace std;
using namespace __gnu_cxx;
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("-O1")
//-------------------------------------------------------------//
typedef long long ll;
typedef unsigned long long ull;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sum_to(n) (n*(n+1))/2
#define pb push_back
#define pf push_front
#define sz size()
#define fil(arr,x) memset(arr,x,sizeof(arr))
const ll mod=1e9+7;
int dx[8]={0,1,0,-1,1,1,-1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
//-------------------------------------------------------------//
ll lcm(ll a,ll b)
{
    return (max(a,b)/__gcd(a,b))*min(a,b);
}
void person_bool(bool x)
{
    cout<<(x?"YES":"NO")<<endl;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    fast
    int r,c,n;
    cin>>r>>c>>n;
    map<int,set<int>>arr;
    for(int i=0;i<n;i++){
    	int x,y;
    	cin>>x>>y;
    	arr[x].insert(y);
    }
    int q;cin>>q;
    while(q--){
    	int x,y,a,b;
    	cin>>x>>y>>a>>b;
    	if(a<x ||  b<y || a-x>n){
    		cout<<"No"<<endl;
    	}
    	else{
    		int p=y;
    		bool valid=1;
    		for(int i=x;i<a;i++){
    			if(!arr[i].sz){
    				valid=0;
    				break;
    			}
    			int j=*(arr[i].lb(p));
    			if(j==arr[i].sz || j>b){
    				valid=0;
    				break;
    			}
    			else{
    				p=j;
    			}
    		}
    		cout<<(valid?"Yes":"No")<<endl;
    	}
    }
    return 0;
}

Compilation message

trampoline.cpp: In function 'int main()':
trampoline.cpp:64:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |        if(j==arr[i].sz || j>b){
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 724 KB expected YES, found NO [132nd token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 154 ms 9848 KB expected YES, found NO [3477th token]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 231 ms 10376 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 255 ms 22092 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 264 ms 22140 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 312 ms 22240 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 280 ms 22344 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 403 ms 28236 KB 200000 token(s): yes count is 97163, no count is 102837
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 468 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 14 ms 864 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 8 ms 1324 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 6 ms 832 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 287 ms 984 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 5 ms 852 KB 5000 token(s): yes count is 3390, no count is 1610
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2072 ms 17172 KB Time limit exceeded
2 Halted 0 ms 0 KB -