QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#775256#9786. Magical Bagsucup-team5697#WA 1ms3936kbC++14981b2024-11-23 15:12:362024-11-23 15:12:37

Judging History

你现在查看的是最新测评结果

  • [2024-11-23 15:12:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3936kb
  • [2024-11-23 15:12:36]
  • 提交

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;
	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("2.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: 0ms
memory: 3900kb

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: 3832kb

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: 3936kb

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: 3756kb

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: 3904kb

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:

186

result:

wrong answer 1st numbers differ - expected: '177', found: '186'