Submission #685909

# Submission time Handle Problem Language Result Execution time Memory
685909 2023-01-25T03:54:31 Z Alihan_8 Trampoline (info1cup20_trampoline) C++17
73 / 100
2000 ms 17144 KB
#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;
#define all(x) x.begin(), x.end()
#define pb push_back
// define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define mpr make pair
#define ln '\n'
void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define int long long
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int r, c, n; cin >> r >> c >> n;
    map <int,set<int>> st;
    for ( int i = 1; i <= n; i++ ){
        int x, y; cin >> x >> y;
        st[--x].insert(--y);
    }
    int t; cin >> t;
    while ( t-- ){
        int xs, ys, xe, ye;
        cin >> xs >> ys >> xe >> ye;
        if ( xs > xe or ys > ye ){
            cout << "No\n";
            continue;
        }
        xs--, xe--, ys--, ye--;
        bool flag = true;
        while ( xs < xe ){
            auto it = st[xs].lower_bound(ys);
            if ( it == st[xs].end() or *it > ye ){
                flag = false;
                break;
            }
            ys = *it;
            xs++;
        }
        if ( flag ) cout << "Yes\n";
        else cout << "No\n";
    }

    cout << '\n';
}

Compilation message

trampoline.cpp: In function 'void IO(std::string)':
trampoline.cpp:11:29: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp:11:70: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                                                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 724 KB 200 token(s): yes count is 21, no count is 179
2 Correct 4 ms 724 KB 200 token(s): yes count is 70, no count is 130
3 Correct 3 ms 596 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 190 ms 9932 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 208 ms 9892 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 450 ms 9864 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 471 ms 10132 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Correct 243 ms 10316 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 293 ms 10392 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 244 ms 10348 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 336 ms 10532 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 287 ms 10520 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 366 ms 16620 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Correct 5 ms 468 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 10 ms 852 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 8 ms 1356 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 6 ms 856 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 222 ms 1112 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
# Verdict Execution time Memory Grader output
1 Execution timed out 2090 ms 17144 KB Time limit exceeded
2 Halted 0 ms 0 KB -