답안 #520734

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
520734 2022-01-31T00:25:58 Z QuantumK9 Trampoline (info1cup20_trampoline) C++17
43 / 100
102 ms 4984 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple 
 
using namespace std;
 
void solve(){
    
    ll r,c,n;
    cin >> r >> c >> n;
    
    vector<vector<ll> > down(r);
  
    while(n--){
        ll x,y; cin >> x >> y; x--; y--;
        down[x].pb(y);
    }

    for( int i = 0; i < r; i++ ){
        sort( down[i].begin(), down[i].end() );
    }
    
    ll t;
    cin >> t;
 
    while(t--){
        ll x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2; x1--; y1--; x2--; y2--;

        if( x1 > x2 ){ cout << "No" << endl; continue; }

        bool yes = true;
        for( int i = x1; i < x2; i++ ){
            auto it = lower_bound( down[i].begin(), down[i].end(), y1 );

            if( it == down[i].end() ){ yes = false; break; }
            y1 = *it;
            if( y1 > y2 ){ yes = false; break; }
        }

        cout << ( yes ? "Yes" : "No") << endl;
    }
 
    return;
 
}
 
int main(){
 
    //freopen( "input.txt", "r", stdin );
 
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
 
    int t = 1; //cin>>t;
    while(t--){ solve(); }
 
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB 200 token(s): yes count is 21, no count is 179
2 Correct 3 ms 460 KB 200 token(s): yes count is 70, no count is 130
3 Correct 2 ms 460 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 4912 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 45 ms 4864 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 88 ms 4160 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 102 ms 4984 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 588 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 576 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 576 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -