| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 108475 | 爱新觉罗·赵文卿·传统美德 | 电视节目安排 | C++ | Accepted | 100 | 3 MS | 264 KB | 622 | 2023-11-03 13:25:04 |
#include <bits/stdc++.h> using namespace std; const int MAX=1050; struct TV{ int start,end; }; typedef TV* myTV; TV t[MAX]; int cmp(const TV p,const TV q) { return p.end<q.end; } int main() { int n,i; int cur; int ans; while(cin>>n){ if(n==0) break; for(i=0;i<n;i++) { cin>>t[i].start ; cin>>t[i].end ; } sort(t,t+n,cmp); cur=t[0].end ; ans=1; for(int i=1;i<n;i++) { if(t[i].start>=cur) { cur=t[i].end ; ans++; } } cout<<ans<<endl; } }