Hello 2020D (multi-set)

If there is a pair of time at a venue and this time coincides with the time of coincidence of the other venues no time is output to NO, output YES.

 // retains a certain time coincides with the screening venues at other venues time right. 7 for (   

     int i=0;i<v.size();++i){
 8         pair<pair<int,int>,pair<int,int> >it=v[i];
 9         pair<int,int>temp=it.first;
10         pair<int,int>temp2=it.second;
11         if(temp.second==0){
12             l.erase(l.find(temp2.first));
13             r.erase(r.find(temp2.second));
14         }
15         else{
 16              multiset < int > :: = X Iterator r.lower_bound (temp2.first);
 . 17              IF (! R.begin X = ()) // if the current is smaller than the start time end time, indicating the venue You may have a pair of time without overlapping the time and the other time coincides venue. 
18 is                  return  0 ;
 . 19              multiset < int > :: = Y Iterator l.upper_bound (temp2.second);
 20 is              IF (! = L.end Y ()) // if the end time is larger than the current start time, indicating this facility may have a pair of time without overlapping the time and the other time coincides venue. 
21 is                  return  0 ;
 22 is              l.insert (temp2.first);
 23 is              r.insert (temp2.second);
 24          }
25     }
26     return 1;
27 }
28 int main(){
29     ios::sync_with_stdio(false);
30     cin.tie(NULL);
31     cout.tie(NULL);
32     int n;
33     cin>>n;
34     int a,b,c,d;
35     for(int i=1;i<=n;++i){
36         cin>>a>>b>>c>>d;
37         v1.push_back(make_pair(make_pair(a,-1),make_pair(c,d)));//The same start time and end time to make the start time standing in the front, because the same start time and end time of the pair is the time overlap, to mark the start of play time than the end of the small time, you can keep more venues A coincidence B screening venues time pair. 
38 is          v1.push_back (the make_pair (the make_pair (B, 0 ), the make_pair (C, D)));
 39          v2.push_back (the make_pair (the make_pair (C, - . 1 ), the make_pair (A, B)));
 40          V2. push_back (the make_pair (the make_pair (D, 0 ), the make_pair (A, B)));
 41 is      }
 42 is      Sort (v1.begin (), v1.end ());
 43 is      Sort (v2.begin (), v2.end ());
 44 is      IF || (Check (V1!)! Check (V2))
 45          COUT << " NO " ;
 46 is      the else 
47         cout<<"YES";
48     return 0;
49 }

Guess you like

Origin www.cnblogs.com/ldudxy/p/12162070.html