QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#723387#9600. Eat, Sleep, RepeatxinlengweishangWA 3ms4028kbC++201.6kb2024-11-07 22:02:382024-11-07 22:02:39

Judging History

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

  • [2024-11-07 22:02:39]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:4028kb
  • [2024-11-07 22:02:38]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool cmp(pair<ll,ll> a,pair<ll,ll> b){
	return a.first<b.first;
}
vector<pair<ll,ll> > st;
vector<int> sst;
ll a[1000010];
void slove(){
	st.clear();
	sst.clear();
	ll n,k;
	scanf("%lld%lld",&n,&k);
	ll ans=0;
	for(ll i=1;i<=n;i++){
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+n+1);
	for(ll i=0;i<k;i++){
		ll a,b;
		scanf("%lld%lld",&a,&b);
		st.push_back({a,b});
	}
	sort(st.begin(),st.end(),cmp);
	sst.push_back(-1);
	for(int i=0;i<k;i++){
		if(st[i].second==0){
			sst.push_back(st[i].first);
		}
	}
	
	if(sst.size()==1){
		ll sum=0;
		for(int i=1;i<=n;i++){
			sum+=a[i];
		} 
		ll ssum=0;
		for(int i=0;i<k;i++){
			if(st[i].first==i){
				if(n-ssum<st[i].second) break;
					sum-=n-ssum-st[i].second;
					ssum+=st[i].second;
			}
			else break;
		}
			if(sum&1) ans=1-ans;
	}
	else{
		int len=sst.size();
		int j=1,q=0;
		for(int i=0;i<len-1;i++){
			ll sum=0;
			ll nnum=0;
			while(j<=n&&a[j]<sst[i+1]){
				sum+=a[j];
				j++;
				nnum=0;
			}
			ll ssum=0;
			for(int m=sst[i]+1;m<sst[i+1];m++){
				if(st[q].first==m){
					if(nnum-ssum<st[q].second) break;
					sum-=nnum-ssum-st[q].second;
					ssum+=st[q].second;
					q++;
				}
				else break;
			}
			
			if(sum&1) ans=1-ans;
			
			
		}
	}
	
	if(ans&1) printf("Pico\n");
	else printf("FuuFuu\n");
	return ;
}
int main(){
	ll T;
	scanf("%lld",&T);
	while(T--) slove();
	return 0;
}
/*
5
2 0
1 2
2 1
1 2
0 1
3 2
3 3 4
0 2
1 1

3 2
2 3 3
1 2
0 1

5 4
6 7 8 12 17
1 1
2 1
9 0
10 1
*/
/*
1
5 4
6 7 8 12 17
1 1
2 1
9 0
10 1
*/

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3892kb

input:

5
2 0
1 2
2 1
1 2
0 1
3 2
3 3 4
0 2
1 1
3 2
2 3 3
1 2
0 1
5 4
6 7 8 12 17
1 1
2 1
9 0
10 1

output:

Pico
FuuFuu
Pico
FuuFuu
Pico

result:

ok 5 lines

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 4028kb

input:

10
1385 1384
914 1004 3060 1953 2517 745 879 849 3254 2069 3574 3705 2941 760 2522 3548 616 1328 1732 2420 2789 2448 3533 2058 308 3094 222 1960 3569 1463 2242 3258 1528 2779 1511 2855 1482 3304 2258 3525 3039 1489 3272 3295 1389 109 3370 2750 2207 1400 1570 888 422 646 3541 202 3384 2874 723 1157 3...

output:

FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
Pico
Pico
Pico

result:

wrong answer 1st lines differ - expected: 'Pico', found: 'FuuFuu'