QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#219068#5140. Frozen Scoreboard4k2kokWA 3ms3600kbC++203.2kb2023-10-18 23:28:452023-10-18 23:28:45

Judging History

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

  • [2023-10-18 23:28:45]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3600kb
  • [2023-10-18 23:28:45]
  • 提交

answer

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

int n, m, k;

void solve() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        int a, b, cnt = 0, flag = 0;
        cin >> a >> b;
        vector<array<int, 4> > vv;
        // ? inform id bef aft time
        vector<array<int, 3> > ans(m + 1);
        // ans i +/-/. num time
        for (int j = 1; j <= m; j++) {
            char ch;
            int x, y;
            cin >> ch;
            if (ch == '+') {
                string str, xx, yy;
                cin >> str;
                for (int k = 0; k < str.length(); k++) {
                    if (str[k] == '/') {
                        xx = str.substr(0, k);
                        yy = str.substr(k + 1);
                    }
                }
                x = stoi(xx), y = stoi(yy);
                ans[j] = {0, x, y};
                a -= 1;
                b -= (x - 1) * 20 + y;
            } else if (ch == '?') {
                cin >> x >> y;
                vv.push_back({j, y - x, x});
                cnt++;
                ans[j] = {3, y, 0};
            } else if (ch == '-') {
                cin >> x;
                ans[j] = {1, x, 0};
            } else {
                ans[j] = {2, 0, 0};
            }
        }
        if (b < 0 || a < 0) {
            cout << "No\n";
            continue;
        }
        for (int sta = 0; sta < (1 << cnt); sta++) {
            vector<array<int, 4> > now; 
            int nowcnt = 0, T = b;
            for (int j = 0; j < cnt; j++) {
                if (sta >> j & 1) {
                    now.push_back(vv[j]);
                    nowcnt++;
                }
            }
            if (a != nowcnt) continue;
            int totpan = 0, nowpan = 0;
            for (auto it : now) {
                totpan += it[2];
                T -= 240 + it[1] * 20;
            }
            if (T < 0) continue;
            int maxT = 59 * a;
            while (T > maxT && nowpan < totpan) {
                T -= 20;
                nowpan++;
            }
            if (T <= maxT && T >= 0) {
                flag = 1;
            } else continue;
            for (auto k : now) {
                ans[k[0]][0] = 0;
                int num = min(nowpan, k[2]);
                int numt = min(T, 59);
                ans[k[0]][1] = k[1] + num + 1;
                ans[k[0]][2] = numt + 240;
                nowpan -= num;
                T -= numt;
            }
            if (flag)
                break;
        }
        if (flag) {
            cout << "Yes\n";
            for (int j = 1; j <= m; j++) {
                if (ans[j][0] == 3) {
                    ans[j][0] = 1;
                }
                if (ans[j][0] == 0) {
                    cout << "+ " << ans[j][1] << '/' << ans[j][2] << '\n';
                } else if (ans[j][0] == 1) {
                    cout << "- " << ans[j][1] << '\n';
                } else {
                    cout << ".\n";
                }
            }
        } else {
            cout << "No\n";
        }
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    solve();
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

Yes
+ 1/6
+ 2/263
+ 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: 3528kb

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
+ 87/280
- 100

result:

ok ok (6 test cases)

Test #3:

score: -100
Wrong Answer
time: 3ms
memory: 3528kb

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
+ 2/298
- 5
+ 3/240
- 5
+ 1/240
- 3
- 5
+ 1/165
- 6
- 5
Yes
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
+ 4/271
.
- 2
- 3
.
Yes
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
Yes
+ 1/195
.
.
.
.
.
.
.
.
- 1
.
.
.
Yes
.
.
.
.
.
.
.
.
.
.
.
.
.
Yes
- 22
- 8
- 6
+ 1/173
- 11
- 9
- 3
- 6
+ 4/29...

result:

wrong answer 8-th number of submission should be in [2, 2] (test case 13)