Submission #845368

# Submission time Handle Problem Language Result Execution time Memory
845368 2023-09-06T13:21:33 Z jamkel19 Trampoline (info1cup20_trampoline) C++14
43 / 100
73 ms 1916 KB
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,m,g,q;
    cin>>n>>m>>g;
    vector<vector<int>>a(n);
    int x,y;
    for(int i=0;i<g;i++)
    {
        cin>>x>>y;
        a[x-1].push_back(y-1);
    }
    for(int i=0;i<n;i++)
    {
        sort(a[i].begin(),a[i].end());
    }
    cin>>q;
    int x1,x2,y1,y2;
    bool p=true;
    int start,meta,s;
    while(q--)
    {
        cin>>x1>>y1>>x2>>y2;
        x1--;x2--;y1--;y2--;
        p=true;
        if(x2<x1 or y2<y1)
        {
            p=false;
        }
        else
        {
        for(int i=x1;i<x2;i++)
        {
            start=0;meta=a[i].size()-1;s=(start+meta)/2;
            while(start<meta)
            {
                if(a[i][s]<y1)
                {
                    start=s+1;
                }
                else
                {
                    meta=s;
                }
                s=(start+meta)/2;
            }
            if(a[i].size()>0)
            {
                if(a[i][s]>=y1 && a[i][s]<=y2)
                {
                    y1=a[i][s];
                }
                else
                {
                    p=false;
                    break;
                }
            }
            else
            {
                p=false;
                break;
            }
        }
        }
        if(p)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB 200 token(s): yes count is 21, no count is 179
2 Correct 2 ms 344 KB 200 token(s): yes count is 70, no count is 130
3 Correct 2 ms 348 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 41 ms 1876 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 54 ms 1872 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 72 ms 1624 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 73 ms 1916 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -