QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#729177#5140. Frozen Scoreboardyixuanoct#WA 5ms3952kbC++202.3kb2024-11-09 16:38:042024-11-09 16:38:09

Judging History

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

  • [2024-11-09 16:38:09]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3952kb
  • [2024-11-09 16:38:04]
  • 提交

answer

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

#define int long long

using pii = pair<int, int>;
int n, m;
void solve() {
    int a, b;
    cin >> a >> b;
    vector<pair<int, pii>> s(m + 1);
    vector<int> p;
    for (int i = 1, x, y;i <= m;i++) {
        char t;
        cin >> t;
        if (t == '+') {
            scanf("%lld/%lld", &x, &y);
            a--;
            b -= (x - 1) * 20 + y;
            s[i] = { 1,{x,y} };
        }
        if (t == '-') {
            cin >> x;
            s[i] = { 2,{x,0} };
        }
        if (t == '?') {
            cin >> x >> y;
            s[i] = { 3,{ x,y } };
            p.push_back(i);
        }
        if (t == '.') s[i] = { 4,{0,0} };
    }
    vector<int> q;
    vector<int> ans;
    bool flag = 0;
    auto dg = [&](int x, int cnt, auto&& dg)->void {
        if (flag) return;
        if (cnt >= a) {
            int res = 0;
            for (auto i : q) {
                auto [_, tmp] = s[i];
                auto [x, y] = tmp;
                b -= (y - x) * 20;
                res += x - 1;
            }
            if (240 * a > b || 300 * a + res * 20 < b) return;
            b -= 240 * a;
            int num = min(b / 20, res);
            b -= num * 20;
            for (auto i : q) {
                auto [_, tmp] = s[i];
                auto [x, y] = tmp;
                int ta = y - x;
                if (x - 1 <= num) num -= x - 1;
                else x = num + 1, num = 0;
                if (240 + b <= 300) y = 240 + b, b = 0;
                else y = 300, b -= 60;
                s[i] = { 1,{x + ta,y} };
            }
            flag = 1;
        }
        if (x >= p.size()) return;
        q.push_back(p[x]);
        dg(x + 1, cnt + 1, dg);
        q.pop_back();
        dg(x + 1, cnt + 1, dg);
        };
    dg(0, 0, dg);
    if (!flag) {
        cout << "No\n";
        return;
    }
    cout << "Yes\n";
    for (int i = 1;i <= m;i++) {
        auto [_, tmp] = s[i];
        auto [x, y] = tmp;
        if (_ == 1) cout << "+ " << x << '/' << y << '\n';
        if (_ == 2) cout << "- " << x << '\n';
        if (_ == 3) cout << "- " << y << '\n';
        if (_ == 4) cout << ".\n";
    }
}

signed main() {
    // ios::sync_with_stdio(false), cin.tie(0);
    cin >> n >> m;
    while (n--) solve();
}

詳細信息

Test #1:

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

input:

1 13
7 951
+ 1/6
? 3 4
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.

output:

Yes
+ 1/6
+ 3/243
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.

result:

ok ok (1 test case)

Test #2:

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

input:

6 2
1 100
.
? 3 4
2 100
+ 1/1
+ 1/2
0 0
- 5
- 6
2 480
? 100 100
? 100 100
2 480
? 99 100
? 100 100
1 2000
? 100 100
? 100 100

output:

No
No
Yes
- 5
- 6
Yes
+ 1/240
+ 1/240
No
Yes
+ 89/240
- 100

result:

ok ok (6 test cases)

Test #3:

score: -100
Wrong Answer
time: 5ms
memory: 3652kb

input:

1000 13
6 1519
+ 3/183
- 1
+ 9/133
? 2 3
- 5
? 1 3
- 5
? 1 1
? 1 3
- 5
+ 1/165
- 6
? 2 5
2 570
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
? 2 5
.
- 2
? 1 3
.
1 140
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
1 195
+ 1/195
.
.
.
.
.
.
.
.
? 1 1
.
.
.
0 0
.
.
.
.
.
.
.
.
.
.
.
.
.
3 776
? 8 22
? 1 8
- 6
+ 1/173
...

output:

Yes
+ 3/183
- 1
+ 9/133
+ 3/278
- 5
+ 3/240
- 5
+ 1/240
- 3
- 5
+ 1/165
- 6
- 5
Yes
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
+ 5/251
.
- 2
- 3
.
Yes
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
Yes
+ 1/195
.
.
.
.
.
.
.
.
- 1
.
.
.
Yes
.
.
.
.
.
.
.
.
.
.
.
.
.
No
Yes
.
- 1
+ 1/285
- 1
+ 1/60
.
.
- 1
.
.
.
.
...

result:

wrong answer ans finds the answer, but out doesn't (test case 6)