QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#782728 | #9600. Eat, Sleep, Repeat | Martian148# | RE | 0ms | 3556kb | C++20 | 1.9kb | 2024-11-25 21:10:43 | 2024-11-25 21:10:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAXN = 2e5 + 5;
ll Tex, n, m, a[MAXN];
void AC(){
cin >> n >> m;
for(int i = 1; i <= n; i ++){
cin >> a[i];
}
a[n + 1] = (ll)(1e9 + 2);
sort(a + 1, a + n + 1);
map<ll, ll> mp;
vector<pair<ll, ll>> q;
vector<ll> idx, b;
b.push_back(0);
q.push_back({-1, 0});
for(int i = 1; i <= m; i ++){
ll x, y;
cin >> x >> y;
q.push_back({x, y});
mp[x] = y;
}
sort(q.begin(), q.end());
for(auto it : q){
if(it.second == 0){
idx.push_back(it.first);
}
}
idx.push_back((ll)(1e9 + 1));
ll dq = 0, l = 1, r = 1;
for(int i = 0; i < idx.size() - 1; i ++){
while(a[r] <= idx[i + 1]) r ++;
ll cnt = r - l;
while(q[dq].first < idx[i]) dq ++;
if(q[dq].first <= idx[i + 1]){
for(int j = q[dq].first + 1; j <= idx[i + 1]; j ++){
if(!mp.count(j)){
while(cnt){
b.push_back(j);
cnt --;
}
}
else{
ll qwq = mp[j];
while(cnt && qwq){
b.push_back(j);
cnt --;
qwq --;
}
}
dq = j + 1;
if(!cnt) break;
}
}
l = r;
}
ll ans = 0;
for(int i = 1; i <= n; i ++){
// cout << b[i] << " ";
ans += a[i] - b[i];
}
if(ans & 1) cout << "Pico\n";
else cout << "FuuFuu\n";
}
int main(){
// freopen("J.in", "r", stdin);
// ios::sync_with_stdio(false);
// cin.tie(0); cout.tie(0);
cin >> Tex;
while(Tex --) AC();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
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
Runtime Error
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...