Submission #845503

# Submission time Handle Problem Language Result Execution time Memory
845503 2023-09-06T13:54:56 Z jamkel19 Trampoline (info1cup20_trampoline) C++14
0 / 100
134 ms 1048576 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<int>v(n,-1);
    vector<vector<int>>a;
    int x,y;
    for(int i=0;i<g;i++)
    {
        cin>>x>>y;
        if(v[x-1]==-1)
        {
            a.push_back({y-1});
            v[x-1]=a.size()-1;
        }
        else
        {
            a[v[x-1]].push_back(y-1);
        }
    }
    cout<<"AAA"<<endl;
    for(int i=0;i<a.size();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 o=x1;o<x2;o++)
        {
            if(v[o]==-1)
            {
                p=false;
                break;
            }
            int i=v[o];
            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][s]>=y1 && a[i][s]<=y2)
                {
                    y1=a[i][s];
                }
                else
                {
                    p=false;
                    break;
                }
        }
        }
        if(p)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
}

Compilation message

trampoline.cpp: In function 'int main()':
trampoline.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=0;i<a.size();i++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB YES or NO expected, but AAA found [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 1952 KB YES or NO expected, but AAA found [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 134 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 117 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 118 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -