QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#770053#9600. Eat, Sleep, Repeatyeah14WA 3ms3744kbC++172.2kb2024-11-21 20:26:022024-11-21 20:26:03

Judging History

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

  • [2024-11-21 20:26:03]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3744kb
  • [2024-11-21 20:26:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ull long long
#define PII  pair<int ,int>
const int INF = 1145141919810;
const int mod = 1e9 + 7;
int fp(int a, int x, int mod) {
    int ans = 1;
    while (x) {
        if (x & 1)ans *= a;
        ans %= mod;
        a *= a;
        a %= mod;
        x >>= 1;
    }
    return ans;
}

const int N = 1e5+5;
map<int, int>p;
int a[N];
vector<PII> xy;

void solve1() {
    int n, k;
    cin >> n >> k;
    p.clear();
    xy.clear();
    priority_queue<int,vector<int>,greater<int>>q;//分界
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        p[a[i]]++;
    }
    int now = -1;
    int minn = 0;
    int sum = minn;
    q.push(-1);
    q.push(INF);
    //if (k == 0)xy.push_back({ 0,INF });
    for (int i = 1; i <= k; i++) {
        int x, y;
        cin >> x >> y;
        if (y == 0) {
            q.push(x);
            xy.push_back({ minn,INF });
            minn = x + 1;
            continue;
        }
        if (minn == x) {
            xy.push_back( { x,y });
            minn++;
        }
    }
    xy.push_back({ minn,INF });
    sort(xy.begin(), xy.end());
    auto pp=p.begin();
    int j = 0;
    int ans = 0;
    while (!q.empty()&&pp!=p.end()) {
        q.pop();
        int t = q.top();
        int cnt1 = 0;
        int sum = 0;
        while (pp!=p.end()&&(*pp).first <= t) {
            sum+=(*pp).second*(*pp).first;
            cnt1 += (*pp).second;
            pp++;
            
        }
        int cnt = 0;
        int sum2 = 0;
        while (cnt < cnt1&&j<xy.size() && xy[j].first < t) {
            int cc = min(xy[j].second, cnt1 - cnt);
            cnt += cc;
            sum2 += cc * xy[j].first;
            j++;
        }
        ans += max(sum - sum2,0LL);
        while (j<xy.size()&&xy[j].first <= t) {
            j++;
        }
    }
    if (ans % 2 == 0)cout << "FuuFuu" << endl;
    else cout << "Pico" << endl;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t=1;
    cin >> t;
    while (t--) {
        solve1();
    }
}
/*
1
5 4
1 2 3 4 5
0 1
1 1
2 1
3 0
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3ms
memory: 3744kb

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

result:

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