最后两个点TLE,只有70分,Why,谁来帮帮我!!!

P1803 凌乱的yyy / 线段覆盖

@[Van♂様年华](/space/show?uid=86973) 右转百度学习结构体
by star_magic_young @ 2018-06-15 14:12:33


@[star_magic_young](/space/show?uid=38372) 我试试
by 花园Serena @ 2018-06-15 14:12:39


@[star_magic_young](/space/show?uid=38372) AC了 谢谢dalao ``` #include<bits/stdc++.h> using namespace std; struct wdf{ int a; int b; }; wdf c[1000001]; bool cmp(wdf a ,wdf b) { if (a.b<b.b) return true; return false ; } int main() { int x=1,i,j,n,sum=1; cin>>n; for(i=1;i<=n;i++) cin>>c[i].a>>c[i].b; sort(c+1,c+n+1,cmp); for(i=2;i<=n;i++) if(c[x].a<=c[i].a) if(c[i].a>=c[x].b) x=i,sum++; cout<<sum; return 0; } ```
by 花园Serena @ 2018-06-15 14:22:57


@[Van♂様年华](/space/show?uid=86973) 不谢${\ \ }\color{white}\text{顺便一提我是蒟蒻}$
by star_magic_young @ 2018-06-15 14:29:20


上一页 |