QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#775920#9600. Eat, Sleep, RepeatrujieWA 0ms3620kbC++232.4kb2024-11-23 17:03:282024-11-23 17:03:28

Judging History

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

  • [2024-11-23 17:03:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2024-11-23 17:03:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define debug(a) cout << #a << " = " << a << endl;

void solve()
{
    int n, k;
    cin >> n >> k;
    vector<int> v(n + 1);
    map<int, int> mp;
    for (int i = 1; i <= n; i++)
    {
        cin >> v[i];
        mp[v[i]]++;
    }

    sort(v.begin(), v.end());
    vector<pii> b(k + 1);
    for (int i = 1; i <= k; i++)
    {
        cin >> b[i].first >> b[i].second;
        if (mp[b[i].first] > b[i].second)
        {
            cout << "FuuFuu" << endl;
            return;
        }
    }
    sort(b.begin(), b.end());
    vector<int> t(n + 1);
    int p = 0;
    int pos = 1;
    int flag = 0;
    for (int i = 1; i <= k; i++)
    {
        if (b[i].second != 0)
        {

            if (b[i].first > p)
            {
                continue;
            }
            else
            {
                for (int j = pos; j < pos + b[i].second && j <= n; j++)
                {
                    t[j] = p;
                }
                pos += b[i].second;
                p++;
            }
        }
        else
        {
            for (int j = pos; j <= n; j++)
            {
                if (v[j] > b[i].first)
                {
                    flag = 1;
                    p = b[i].first + 1;
                    t[j] = p;
                    pos = j;
                    break;
                }
                else
                {
                    t[j] = p;
                }
            }
        }
    }

    for (int i = pos; i <= n; i++)
    {
        t[i] = p;
    }
    int res1 = 0, res2 = 0;
    for (int i = 1; i <= n; i++)
    {
        res1 += v[i];
        res2 += t[i];
        cout << t[i] << " ";
    }
    // cout<<endl;
    // debug(res1);
    // debug(res2);
    int ans = res1 - res2;
    // debug(ans);
    //  cout<<res2-res1<<endl;

    if (ans & 1)
    {
        cout << "Pico" << endl;
    }
    else
    {
        cout << "FuuFuu" << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);

    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }

    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

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3620kb

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:

0 0 Pico
0 1 FuuFuu
0 0 1 Pico
0 1 1 FuuFuu
0 0 0 10 11 Pico

result:

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