Submission #365961

# Submission time Handle Problem Language Result Execution time Memory
365961 2021-02-12T15:24:59 Z soba Trampoline (info1cup20_trampoline) C++14
0 / 100
174 ms 31104 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    ll r , c , n , x , y , a, b, t;
    cin >> r>> c >> n ;
    int next[r+1][c+1] , grid[r+1][c+1]={0};
    vector<int>v[200001];
    map<int,int>mp;
    int cnt=1;
    for(int i = 0 ; i < n ; i++)
    {
        cin >> x>> y ;
        if(!mp[x])mp[x]=cnt++;
        v[mp[x]].push_back(y);
    }
//    for(int i = 1 ; i <= r ; i++)
//    {
//        x=c+1;
//        for(int j = c; j>=1 ; j--)
//        {
//            if(grid[i][j])x=j;
//            next[i][j]=x;
//        }
//    }
//    for(int i = 1 ; i <= r ; i++)
//    {
//        x=c+1;
//        for(int j = 1; j<=c ; j++)
//        {
//            cout << next[i][j]<< " ";
//        }
//        cout << "\n";
//    }
    cin >> t;
    while(t--)
    {
        cin>> x >> y >> a >> b ;
        if(x==a)
        {
            if(y<=b)
            {
                cout << "Yes\n";
            }
            else cout << "No\n";
            continue;
        }
        int j=y;
        int impos=1;
        for(int i = x ; i<a ; i++)
        {
            if(mp[i]==0)
            {
                impos=0;
                break;
            }
            auto it = lower_bound(v[mp[i]].begin() , v[mp[i]].end() , j);
            if(it==v[mp[i]].end())
            {
            	j=c+1;
            }
            else j=*it;
            if(j>b)
            {
                impos=1;
                break;
            }
            if(i==a-1)
            {
                impos=0;
            }
        }
        if(impos)
        {
            cout << "No\n";
        }
        else cout << "Yes\n";
    }
    return 0;
}

Compilation message

trampoline.cpp: In function 'int main()':
trampoline.cpp:10:9: warning: unused variable 'next' [-Wunused-variable]
   10 |     int next[r+1][c+1] , grid[r+1][c+1]={0};
      |         ^~~~
trampoline.cpp:10:26: warning: unused variable 'grid' [-Wunused-variable]
   10 |     int next[r+1][c+1] , grid[r+1][c+1]={0};
      |                          ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 5356 KB expected YES, found NO [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 174 ms 31104 KB expected YES, found NO [3rd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 420 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -