QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#775121 | #9786. Magical Bags | ucup-team4770# | WA | 1ms | 5876kb | C++17 | 1.1kb | 2024-11-23 14:47:36 | 2024-11-23 14:47:36 |
Judging History
answer
//Date: 2024-11-23 14:40:13
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int rd() {
int s=0,m=0;char ch=getchar();
while(!isdigit(ch)) {if(ch=='-')m=1;ch=getchar();}
while( isdigit(ch)) s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
return m?-s:s;
}
bool MBE;
namespace SOLVER {
int n,cnt,f[200005],g[200005];struct QWQ {int l,r;} a[200005],b[200005];
bool cmp(QWQ a1,QWQ a2) {return a1.r!=a2.r?a1.r<a2.r:a1.l<a2.l;}
void MAIN() {
cin>>n;
for(int i=1;i<=n;i++) {
int len=rd();a[i].l=1e9+1,a[i].r=0;
for(int j=1,x;j<=len;j++) x=rd(),a[i].l=min(a[i].l,x),a[i].r=max(a[i].r,x);
}
sort(a+1,a+n+1,cmp);int Mx=0;
for(int i=1;i<=n;i++) {
if(a[i].l>Mx) b[++cnt]=a[i];
Mx=max(Mx,a[i].l);
}
int las=0,ans=0;
for(int i=1;i<=n;i++) if(b[i].l>b[las].r) las=i,ans++;
cout<<2*n-ans<<endl;
}
}
bool MED;
signed main() {
//freopen(".in","r",stdin);freopen(".out","w",stdout);
for(int tt=1;tt;tt--) SOLVER::MAIN();
cerr<<(&MBE-&MED)/1024<<" KB, "<<1000*clock()/CLOCKS_PER_SEC<<" ms\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 5876kb
input:
4 3 4 7 10 2 1 9 4 11 2 8 14 3 6 12 13
output:
7
result:
ok 1 number(s): "7"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5728kb
input:
4 1 1 1 2 1 3 1 4
output:
4
result:
ok 1 number(s): "4"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5608kb
input:
4 3 4 7 10 2 1 9 4 11 2 8 14 3 6 12 13
output:
7
result:
ok 1 number(s): "7"
Test #4:
score: 0
Accepted
time: 1ms
memory: 5724kb
input:
4 1 1 1 2 1 3 1 4
output:
4
result:
ok 1 number(s): "4"
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 5728kb
input:
100 4 372861091 407948190 424244630 359746969 6 568180757 527358812 494745349 665803213 674832670 586694351 4 696340797 775899164 919971335 716827187 4 123145962 344250363 122030550 251739234 4 342654413 368648894 150539766 255189030 1 194505887 3 755984448 736803561 745474041 4 709314938 498953418 ...
output:
175
result:
wrong answer 1st numbers differ - expected: '177', found: '175'