Submission #525464

# Submission time Handle Problem Language Result Execution time Memory
525464 2022-02-11T17:37:50 Z scwadr Trampoline (info1cup20_trampoline) C++17
73 / 100
2000 ms 21596 KB
#include <bits/stdc++.h>

using namespace std;

map<int, vector<int>> mp;
int xf, yf, xs, ys;
int yyy;
pair<int, int> coords[200000];

bool wae(int x, int y)
{
    //cout<<x<<' '<<y<<'\n';
    if(xf<x || yf<y)
    {
        //cout<<"huyher\n";
        return 0;
    }
    else if(xf==x) return 1;
    else
    {
        yyy=lower_bound(mp[x].begin(), mp[x].end(), y)-mp[x].begin();
        //cout<<x<<' '<<yyy<<' '<<mp[x][yyy]<<'\n';
        if(yyy==mp[x].size())
        {
            //cout<<yyy<<"\n";
            return false;
        }
        else return wae(x+1, mp[x][yyy]);
    }
}
/*
100 100 10
2 3
4 5
2 1
3 2
3 10
100 100
100 100
100 100
100 100
100 100
100
*/
int main()
{
    int r, c, n ,t;
    cin>>r>>c>>n;
    for(int i=0; i<n; i++)
    {
        cin>>coords[i].first;
        cin>>coords[i].second;
    }
    sort(coords, coords+n);
    for(int i=0; i<n; i++)
    {
        mp[coords[i].first].push_back(coords[i].second);
    }
    /*for(auto i : mp)
    {
        cout<<i.first<<'\n';
        for(auto j : i.second)
        {
            cout<<j<<' ';
        }
        cout<<'\n'<<'\n';
    }*/
    cin>>t;
    while(t--)
    {
        cin>>xs>>ys>>xf>>yf;
        if(xf-xs>n) cout<<"No\n";
        else if(wae(xs, ys))    cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}

Compilation message

trampoline.cpp: In function 'bool wae(int, int)':
trampoline.cpp:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         if(yyy==mp[x].size())
      |            ~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 332 KB 200 token(s): yes count is 21, no count is 179
2 Correct 7 ms 460 KB 200 token(s): yes count is 70, no count is 130
3 Correct 7 ms 332 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 158 ms 3284 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 156 ms 5124 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 360 ms 4420 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 546 ms 5580 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Correct 727 ms 3540 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 765 ms 15140 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 807 ms 15076 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 788 ms 15520 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 809 ms 15548 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 901 ms 21596 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 27 ms 580 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 19 ms 1200 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 21 ms 668 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 503 ms 968 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 18 ms 580 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2084 ms 18068 KB Time limit exceeded
2 Halted 0 ms 0 KB -