QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#730122#9600. Eat, Sleep, RepeatyzhxAC ✓37ms7084kbC++202.5kb2024-11-09 18:47:152024-11-09 18:47:15

Judging History

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

  • [2024-11-09 18:47:15]
  • 评测
  • 测评结果:AC
  • 用时:37ms
  • 内存:7084kb
  • [2024-11-09 18:47:15]
  • 提交

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, num = 0;
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;
    //    cout << l[L].x << endl;
 //   if (mp[l[L].x] > 0) num += mp[l[L].x];
  //  if (num > 1) return -1;
    int sum1 = 0, sum2 = 0, sss = 0, fff = -1;
    //   cout << num << endl;
    int lst = now;
    while (now <= n && a[now] < l[R + 1].x) sum2 += a[now], now++;
    if (now <= n && a[now] <= l[R + 1].x) sum2 += a[now], now++;
    for (int i = L + 1; i <= R; ++i) {
   //     if (mp[l[i].x] > l[i].y) num += mp[l[i].x] - l[i].y;
   //     if (num > 1) return -1;
        if (fff == -1 && l[i].x - l[L].x != i - L) fff = l[i - 1].x + 1;
        if (fff == -1) {
            int qwe = min(now - lst - sss, l[i].y);
            sum1 += l[i].x * qwe, sss += qwe;
        }
    }
    if (fff == -1) fff = l[R].x + 1;

    //    cout << L << ' ' << R << ": " << num << ' ' << 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;
        num = 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 << ' ' << num << endl;
        if (now == -1 || num > 1) {
            puts("FuuFuu");
            continue;
        }
        if (ans & 1)
            puts("Pico");
        else
            puts("FuuFuu");
    }
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5688kb

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: 0
Accepted
time: 3ms
memory: 3908kb

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

result:

ok 10 lines

Test #3:

score: 0
Accepted
time: 3ms
memory: 3788kb

input:

10
410 3642
12 31 32 94 158 173 207 258 260 260 260 285 290 324 343 439 478 538 547 577 580 589 591 621 664 712 952 996 1012 1071 1140 1139 1208 1236 1289 1326 1337 1343 1378 1495 1519 1545 1581 1669 1770 1770 1778 1890 1890 1907 1972 2165 2202 2383 2412 2431 2433 2433 2479 2520 2530 2588 2588 2648 ...

output:

Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico

result:

ok 10 lines

Test #4:

score: 0
Accepted
time: 37ms
memory: 7084kb

input:

10
4807 9172
11074816 21700232 12027380 5252042 10556858 6407544 27365311 4848167 25878417 5946801 19518201 26865211 24354815 5300803 10207270 13707001 20201928 23457763 16935183 3234656 13050070 8939102 27075736 5681724 22896409 4514036 17525921 6733562 15054222 25120620 27494363 19347128 12197082 ...

output:

Pico
Pico
Pico
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico

result:

ok 10 lines

Test #5:

score: 0
Accepted
time: 25ms
memory: 4204kb

input:

100
990 472
28844876 78590 19508191 2217208 29715575 23360037 2310683 13083254 18323730 5145186 12688522 14124191 58291 27350803 15025459 30069926 4286262 30124623 28860033 19004576 13044769 10432625 19029470 25996167 42388106 46233492 44327888 45898284 40151296 41916978 42328606 34985957 42183568 4...

output:

Pico
Pico
FuuFuu
Pico
Pico
FuuFuu
Pico
FuuFuu
FuuFuu
Pico
Pico
Pico
FuuFuu
Pico
Pico
FuuFuu
Pico
Pico
Pico
Pico
Pico
FuuFuu
FuuFuu
Pico
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
Pico
Pico
Pico
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
Pico
FuuF...

result:

ok 100 lines

Test #6:

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

input:

1000
127 71
21180842 42764613 30189175 27793169 53721539 57788405 86051527 80695979 87346062 107554780 112121703 109146863 113178493 115291367 112406859 112382955 109393081 117329125 123879955 125903553 127457129 118660927 139389113 136043291 138857596 139575620 142059087 140442829 143584516 1543205...

output:

Pico
Pico
Pico
FuuFuu
Pico
Pico
Pico
Pico
Pico
FuuFuu
Pico
Pico
Pico
FuuFuu
Pico
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
Pico
Pico
Pico
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
Pico
FuuFuu
Pico
Pico
FuuFuu
F...

result:

ok 1000 lines

Test #7:

score: 0
Accepted
time: 12ms
memory: 3644kb

input:

10000
7 0
871666936 556119639 455516542 940151456 802805874 419872999 998447411
2 8
549493070 514292981
156471648 1
737047418 2
127136417 2
792420753 2
747110888 2
0 2
16637980 1
703095425 1
8 1
624297658 327331823 8419663 345423038 168117605 744911201 152096038 222910156
136474984 4
3 15
197038919 ...

output:

Pico
Pico
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
Pico
Pico
Pico
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
Pico
Pico
Pico
FuuFuu
Pico
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
...

result:

ok 10000 lines

Test #8:

score: 0
Accepted
time: 7ms
memory: 4564kb

input:

10
39440 39440
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...

output:

FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
Pico

result:

ok 10 lines

Test #9:

score: 0
Accepted
time: 5ms
memory: 5760kb

input:

100
2975 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

Pico
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
Pico
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFu...

result:

ok 100 lines

Test #10:

score: 0
Accepted
time: 6ms
memory: 5624kb

input:

1000
61 61
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100...

output:

FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
Pico
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
Pi...

result:

ok 1000 lines

Test #11:

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

input:

10000
27 27
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10...

output:

FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
Pico
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
FuuFuu
Pico
Pico
FuuFuu
FuuFuu
FuuFuu
Fuu...

result:

ok 10000 lines

Test #12:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

2
2 2
2 7
0 1
13 0
2 1
2 7
0 1

output:

FuuFuu
FuuFuu

result:

ok 2 lines

Extra Test:

score: 0
Extra Test Passed