답안 #691757

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
691757 2023-01-31T14:07:46 Z Aiperiii Trampoline (info1cup20_trampoline) C++14
62 / 100
2000 ms 11788 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
    int r,c,n;
    cin>>r>>c>>n;
    map <int,vector <long long > > mp;
    while(n--){
        int x,y;
        cin>>x>>y;
        mp[x].push_back(y);
    }
    for(auto x : mp){
        vector <long long > vec=x.second;
        sort(vec.begin(),vec.end());
        mp[x.first]=vec;
    }
    int t;
    cin>>t;
    while(t--){
        int x1,x2,y1,y2;
        cin>>x1>>y1>>x2>>y2;
        string ans="Yes";
        if(x1>x2 or y1>y2){
            ans="No";
        }
        int y=y1;
        for(int i=x1;i<x2;i++){
            vector < long long > vec=mp[i];
            if(vec.size()==0){
                ans="No";
                break;
            }
            vec.insert(vec.begin(),-2e9);
            vec.push_back(2e9);
            long long l=0;
            long long r=vec.size();
            while(r-l>1){
                long long mid=(l+r)/2;
                if(vec[mid]<y){
                    l=mid;
                }
                else{
                    r=mid;
                }
            }
            if(r==vec.size()-1 ){
                ans="No";
                break;
            }
            else {
                y=vec[r];
            }
        }
        if(y>y2){
            ans="No";
        }
        cout<<ans<<endl;
    }
}

Compilation message

trampoline.cpp: In function 'int main()':
trampoline.cpp:46:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |             if(r==vec.size()-1 ){
      |                ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 468 KB 200 token(s): yes count is 21, no count is 179
2 Correct 7 ms 468 KB 200 token(s): yes count is 70, no count is 130
3 Correct 5 ms 440 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 163 ms 4760 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 165 ms 5136 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 652 ms 4264 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 585 ms 5228 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2027 ms 7164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 724 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 31 ms 728 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 21 ms 1080 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 25 ms 604 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 278 ms 800 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 29 ms 708 KB 5000 token(s): yes count is 3390, no count is 1610
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2016 ms 11788 KB Time limit exceeded
2 Halted 0 ms 0 KB -