QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#775264 | #9786. Magical Bags | ucup-team5697# | WA | 1ms | 3932kb | C++14 | 1000b | 2024-11-23 15:14:11 | 2024-11-23 15:14:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;bool Mbe;
namespace MAOJUN{
typedef pair<int,int> pi;
const int N=2e5+5;
int n;
pi a[N];bool vs[N];
#define fi first
#define se second
inline void main(){
scanf("%d",&n);
int sum=0;
for(int i=1,k,x;i<=n;i++){
scanf("%d",&k);
int l=1e9,r=0;
while(k--){scanf("%d",&x);l=min(l,x);r=max(r,x);}
a[i]=pi(l,r);if(l==r)sum++;else sum+=2;
}
sort(a+1,a+n+1,[&](pi x,pi y){return x.fi^y.fi?x.fi>y.fi:x.se<y.se;});
int mn=1e9+1;
for(int i=1;i<=n;i++)
if(a[i].se<mn){
mn=a[i].se;
if(a[i].fi!=a[i].se)vs[i]=1;
}
int m=0;for(int i=1;i<=n;i++)if(vs[i])a[++m]=a[i];
n=m;sort(a+1,a+n+1);
for(int p=1;p<=n;){
sum--;
p=upper_bound(a+1,a+n+1,pi(a[p].se,0))-a;
}
printf("%d\n",sum);
}
}bool Med;int main(){
#ifdef LOCAL
freopen("1.in","r",stdin);
freopen("data.out","w",stdout);
atexit([](){fprintf(stderr,"%dms\n%lfMB\n",clock(),(&Mbe-&Med)/1024./1024);});
#endif
MAOJUN::main();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3872kb
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: 3880kb
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: 3932kb
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: 3736kb
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: 1ms
memory: 3832kb
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'