QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#139884#6392. CurtainsWawi#0 115ms11468kbC++201.5kb2023-08-14 19:00:552024-07-04 01:42:19

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 01:42:19]
  • 评测
  • 测评结果:0
  • 用时:115ms
  • 内存:11468kb
  • [2023-08-14 19:00:55]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(){
    int n,m,q; cin >> n >> m >> q;
    vector<vector<int>> R(n+1);
    vector<vector<int>> L(n+1);
    for(int i=0; i < m;i++){
        int l,r; cin >> l >> r;
        if(l>r) swap(l,r);
        R[r].push_back(l);
        L[l].push_back(r);
    }
    while(q--){
        int l,r; cin >> l >> r;
        int mxl=-1e9,mxr=1e9;
        queue<int> q;
        for(auto c : L[l]){
            if(c <= r) q.push(c);
        }
        vector<bool> foundl(n+1),foundr(n+1);
        while(!q.empty()){
            int curr=q.front();
            q.pop();
            if(foundl[curr]) continue;
            foundl[curr]=true;
            mxl=max(mxl,curr);
            for(auto c : L[curr]){
                if(c <= r) q.push(c);
            }
        }
        for(auto c : R[r]){
            if(c >= l) q.push(c);
        }
        while(!q.empty()){
            int curr=q.front();
            q.pop();
            if(foundr[curr]) continue;
            foundr[curr]=true;
            mxr=min(mxr,curr);
            for(auto c : R[curr]){
                if(c >= l) q.push(c);
            }
        }
        // cout << mxl << ' ' << mxr << ' ';
        if(mxl>=mxr-1) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

int main() {
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3740kb

input:

200 200 200
113 134
77 77
110 143
126 157
122 131
161 172
59 134
19 68
117 142
15 103
61 182
12 67
73 97
72 128
68 110
19 137
14 118
60 150
42 64
25 30
118 158
149 164
79 149
21 94
33 82
3 130
36 142
57 170
64 140
40 98
115 132
2 45
27 85
43 181
120 125
82 160
121 176
16 154
59 74
34 52
71 74
57 185...

output:

NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO...

result:

wrong answer 9th lines differ - expected: 'YES', found: 'NO'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #32:

score: 0
Wrong Answer
time: 115ms
memory: 11468kb

input:

100000 100000 100000
44237 85021
45776 80409
39632 94735
28119 63770
47399 73347
28902 87358
27924 65499
23898 54817
50114 96633
11325 37690
46642 94643
9271 47594
47324 47948
27957 58134
20443 88720
20834 89483
77577 94705
7835 30030
37387 59648
8364 76478
66145 76025
12683 79475
1745 33181
43966 5...

output:

YES
NO
YES
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO...

result:

wrong answer 7th lines differ - expected: 'YES', found: 'NO'

Subtask #5:

score: 0
Skipped

Dependency #3:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%