Submission #525463

# Submission time Handle Problem Language Result Execution time Memory
525463 2022-02-11T17:37:05 Z scwadr Trampoline (info1cup20_trampoline) C++17
0 / 100
2000 ms 101076 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 Incorrect 6 ms 460 KB YES or NO expected, but 98 found [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 178 ms 4424 KB YES or NO expected, but 175 found [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 826 ms 11192 KB YES or NO expected, but 999997485 found [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 716 KB YES or NO expected, but 999850389 found [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2089 ms 101076 KB Time limit exceeded
2 Halted 0 ms 0 KB -