답안 #691749

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
691749 2023-01-31T14:01:02 Z Aiperiii Trampoline (info1cup20_trampoline) C++14
62 / 100
2000 ms 10900 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];
            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:42: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]
   42 |             if(r==vec.size()-1 ){
      |                ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 444 KB 200 token(s): yes count is 21, no count is 179
2 Correct 6 ms 468 KB 200 token(s): yes count is 70, no count is 130
3 Correct 5 ms 444 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 167 ms 3944 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 171 ms 5152 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 570 ms 4044 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 598 ms 5320 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2017 ms 6884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 596 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 32 ms 720 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 22 ms 1080 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 25 ms 692 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 268 ms 724 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 28 ms 720 KB 5000 token(s): yes count is 3390, no count is 1610
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2037 ms 10900 KB Time limit exceeded
2 Halted 0 ms 0 KB -