Submission #365872

# Submission time Handle Problem Language Result Execution time Memory
365872 2021-02-12T13:15:33 Z Belal Trampoline (info1cup20_trampoline) C++14
0 / 100
2000 ms 50724 KB
#include <bits/stdc++.h>
using namespace std;
int r,c,n;
map <int,vector<int> > arr1;
map <int,vector<int> > arr2;
bool fun(int a,int b,int x,int y){
    if(a>x||b>y){return false;}
    if(a==x){return true;}

    int lim=y;
    for(int i=x-1;i>=a;i--){
        if(arr1[i].size()==0){return false;}
        for(int j=0;j<arr1[i].size();j++){
            if(arr1[i][j]<=lim){
                if(arr1[i][j]>b){
                    if(i==a){return true;}
                    lim==arr1[i][j];
                    break;
                }
                else{return false;}
            }
        }
    }
}
int main() {
    int a,b,x,y;
    cin>>r>>c>>n;

    for(int i=0;i<n;i++){
        cin>>a>>b;
        arr1[a].push_back(b);
        arr2[b].push_back(a);
    }
    map<int,vector<int> > :: iterator it=arr1.begin();
    for( ;it != arr1.end();it++){
        sort(arr1[it->first].begin(),arr1[it->first].end(),greater<int>());
    }
    int t;
    cin>>t;
    for(int i=0;i<t;i++){
        cin>>a>>b>>x>>y;
        if(fun(a,b,x,y)){cout<<"Yes"<<endl;}
        else{cout<<"No"<<endl;}
    }

    return 0;
}

Compilation message

trampoline.cpp: In function 'bool fun(int, int, int, int)':
trampoline.cpp:13:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |         for(int j=0;j<arr1[i].size();j++){
      |                     ~^~~~~~~~~~~~~~~
trampoline.cpp:17:24: warning: value computed is not used [-Wunused-value]
   17 |                     lim==arr1[i][j];
trampoline.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 620 KB expected NO, found YES [2nd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2084 ms 4004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 401 ms 50724 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 2028 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2053 ms 35312 KB Time limit exceeded
2 Halted 0 ms 0 KB -