QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#771892 | #9600. Eat, Sleep, Repeat | wcyQwQ# | WA | 4ms | 4076kb | C++14 | 1.0kb | 2024-11-22 16:11:55 | 2024-11-22 16:11:55 |
Judging History
answer
#include<bits/stdc++.h>
#define pb emplace_back
#define ll long long
#define all(b) b.begin(),b.end()
using namespace std;
int t,n,k;
int a[100010];
map<int,int> ss;
struct node
{
int x,y;
friend bool operator < (const node &a,const node &b)
{
return a.x<b.x;
}
}q[100010];
int main()
{
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>t;
while(t--)
{
cin>>n>>k;
ll s=0;
for(int i=1;i<=n;i++) cin>>a[i],s+=a[i];
sort(a+1,a+n+1);
bool f=0;
for(int i=1;i<=k;i++)
{
cin>>q[i].x>>q[i].y;
if(ss[q[i].x]>q[i].y) f=1;
}
k++;
q[k].x=-1;
q[k].y=0;
sort(q+1,q+k+1);
int c=0,op=n;
for(int i=k;i>=1;i--)
{
while(op>0&&a[op]>=q[i].x) op--,c++;
if(q[i].y==0)
{
int d=i+1,p=q[i].x;
while(c)
{
p++;
int cc;
if(d<=k&&q[d].x==p) cc=q[d].y;
else cc=1e9;
if(cc>=c) s-=1ll*c*p,c=0;
else c-=cc,s-=1ll*cc*p;
}
}
}
cout<<(s%2?"Pico\n":"FuuFuu\n");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
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: 4ms
memory: 4076kb
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:
Pico Pico FuuFuu Pico FuuFuu Pico FuuFuu FuuFuu Pico FuuFuu
result:
wrong answer 3rd lines differ - expected: 'Pico', found: 'FuuFuu'