QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#729222#9600. Eat, Sleep, Repeatyzhx#WA 4ms5972kbC++202.2kb2024-11-09 16:44:082024-11-09 16:44:13

Judging History

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

  • [2024-11-09 16:44:13]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:5972kb
  • [2024-11-09 16:44:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
#define get getchar()
#define re
#define in inline
const int _ = 1e5 + 23;
in int read() {
    int t = 0;
    char ch = get;
    while (ch < '0' || ch > '9') ch = get;
    while (ch <= '9' && ch >= '0') t = t * 10 + ch - '0', ch = get;
    return t;
}
struct node {
    int x, y;
} l[_];
int a[_], n, k, ans;
map<ll, int> mp;
int cmp(node a, node b) { return a.x < b.x; }
in int solve(int L, int R, int now) {
    if (now > n) return now;
    if (mp[L] > 1) return -1;
    int sum1 = 0, sum2 = 0, sss = 0, fff = -1;
    for (int i = L + 1; i <= R; ++i) {
        if (mp[l[i].x] > l[i].y + 1) return -1;
        if (fff == -1 && l[i].x - l[L].x != i - L) fff = l[i - 1].x + 1;
        if (fff == -1) sum1 += l[i].x * l[i].y, sss += l[i].y;
    }
    if (fff == -1) fff = l[R].x + 1;
    int lst = now;
    while (now <= n && a[now] < l[R + 1].x) sum2 += a[now], now++;
//    cout << L << ' ' << R << ": " << sum2 << ' ' << sum1 << ' ' << sss << ' ' << now - lst << ' ' << fff << endl;
    ans += max(0LL, sum2 - sum1 - max(0LL, now - lst - sss) * fff);
    return now;
}
signed main() {
    int T = read();
    while (T--) {
        cin >> n >> k;
        mp.clear();
        ans = 0;
        for (int i = 1; i <= n; ++i) {
            a[i] = read();
            if (!mp[a[i]])
                mp[a[i]] = 1;
            else
                mp[a[i]]++;
        }
        sort(a + 1, a + n + 1);
        for (int i = 1; i <= k; ++i) l[i].x = read(), l[i].y = read();
        l[++k].x = -1, l[k].y = 0;
        l[++k].x = 1000000001, l[k].y = 0;
        sort(l + 1, l + k + 1, cmp);
        int lst = 1, now = 1;
        for (int i = 2; i <= k; ++i) {
            if (l[i].y == 0) {
                now = solve(lst, i - 1, now);
                if (now == -1) break;
                lst = i;
            }
        }
//        cout << ans << endl;
        if (now == -1) puts("Pico");
        if (ans & 1)
            puts("Pico");
        else
            puts("FuuFuu");
    }
}

/*

 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
*/

详细

Test #1:

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

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

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
FuuFuu
Pico
Pico
Pico
Pico
Pico
Pico
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu

result:

wrong answer 2nd lines differ - expected: 'Pico', found: 'FuuFuu'