QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#522416#5110. SplitstreamJooDdaeWA 0ms3628kbC++201.2kb2024-08-16 22:37:042024-08-16 22:37:04

Judging History

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

  • [2024-08-16 22:37:04]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3628kb
  • [2024-08-16 22:37:04]
  • 提交

answer

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

int m, n, q, s[100100], p[100100], r[100100];

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> m >> n >> q;

    s[1] = m;

    for(int i=1;i<=n;i++) {
        char c; cin >> c;
        int x, y, z; cin >> x >> y >> z;

        if(c == 'S') {
            p[y] = p[z] = x;
            r[y] = -1, r[z] = -2;
            s[y] = (s[x]+1)/2;
            s[z] = s[x]/2;
        } else {
            p[z] = x, r[z] = y;
            s[z] = s[x]+s[y];
        }
    }

    while(q--) {
        int u, c; cin >> u >> c;

        if(s[u] < c) {
            cout << "none\n";
            continue;
        }

        while(u != 1) {
            int A = p[u], B = r[u];
            if(B < 0) {
                u = A;
                c = c*2 - (B == -1);
            } else {
                if(c <= min(s[A], s[B])*2) {
                    u = c % 2 ? A : B;
                    c = (c+1)/2;
                } else {
                    u = s[A] > s[B] ? A : B;
                    c = c - min(s[A], s[B]);
                }
            }
        }

        cout << c << "\n";
    }
}

详细

Test #1:

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

input:

5 8 26
M 8 9 13
S 2 4 5
S 1 2 3
M 6 5 8
S 4 9 10
S 10 14 15
S 3 6 7
S 7 11 12
2 3
2 4
3 2
3 3
4 2
4 3
5 1
5 2
6 1
6 2
7 1
7 2
8 2
8 3
9 1
9 2
10 1
10 2
11 1
11 2
12 1
13 3
13 4
14 1
14 2
15 1

output:

5
none
4
none
none
none
none
none
2
none
4
none
none
none
none
none
none
none
4
none
none
none
none
none
none
none

result:

wrong answer 5th lines differ - expected: '5', found: 'none'