QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#678606#5140. Frozen Scoreboardlmx111TL 3ms4336kbC++203.9kb2024-10-26 15:31:202024-10-26 15:31:21

Judging History

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

  • [2024-10-26 15:31:21]
  • 评测
  • 测评结果:TL
  • 用时:3ms
  • 内存:4336kb
  • [2024-10-26 15:31:20]
  • 提交

answer

// Coded by hjxddl
#include <bits/stdc++.h>
#define ll long long
#define db double
const int N = 2e5 + 5;
int n, m;
struct team {
    int a, b;
    char c[15], ansc[15];
    int x[15], y[15];
    int ansx[15], ansy[15], ansb[15];
    int l[15], r[15];
    bool vis1, vis[15];
    void dfs(int x) {
        if (x == a + 1) {
            int l1 = 0, r1 = 0;
            int b1 = b, a1 = a;
            for (int i = 1; i <= m; i++) {
                if (!vis[i] || c[i] != '?') continue;
                l1 += l[i], r1 += r[i];
                b1 -= l[i];
            }
            if (l1 <= b && b <= r1) {
                vis1 = 1;
                for (int i = 1; i <= m; i++) {
                    if (!vis[i] || c[i] != '?') continue;
                    ansb[i] = l[i] + std::min(b1, r[i] - l[i]);
                    // std::cerr << ansb[i] << " " << l[i] << " " << r[i] << " " << b1 << " " << a1 << '\n';
                    b1 -= std::min(b1, r[i] - l[i]);
                    a1--;
                    ansc[i] = '+';
                    ansy[i] = ansb[i] % 20 + 240;
                    ansx[i] = (ansb[i] - ansy[i]) / 20 + 1;
                    if (ansx[i] > y[i]) {
                        ansy[i] += 20 * (ansx[i] - y[i]);
                        ansx[i] = y[i];
                    }
                }
                for (int i = 1; i <= m; i++) {
                    if (vis[i] || c[i] != '?') continue;
                    ansc[i] = '-';
                    ansx[i] = y[i];
                }
            }
            return;
        }
        for (int i = 1; i <= m; i++) {
            if (vis[i] || c[i] != '?') continue;
            vis[i] = 1;
            dfs(x + 1);
            if (vis1) return;
            vis[i] = 0;
        }
    }
    void solve() {
        for (int i = 1; i <= m; i++) {
            if (c[i] == '+') {
                a--;
                b -= (x[i] - 1) * 20 + y[i];
            }
            if (c[i] == '?') {
                l[i] = (y[i] - x[i]) * 20 + 240, r[i] = (y[i] - 1) * 20 + 299;
            }
        }
        // std::cerr << a << " " << b << '\n';
        dfs(1);
    }
} t[1005];
void solve() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf("%d%d", &t[i].a, &t[i].b);
        for (int j = 1; j <= m; j++) {
            char c;
            std::cin >> c;
            // std::cerr << c << '\n';
            if (c == '+') {
                t[i].c[j] = t[i].ansc[j] = '+';
                scanf(" %d/%d", &t[i].x[j], &t[i].y[j]);
                t[i].ansx[j] = t[i].x[j];
                t[i].ansy[j] = t[i].y[j];
            }
            if (c == '-') {
                t[i].ansc[j] = t[i].c[j] = '-';
                scanf(" %d", &t[i].ansx[j]);
            }
            if (c == '?') {
                t[i].c[j] = '?';
                scanf(" %d %d", &t[i].x[j], &t[i].y[j]);
            }
            if (c == '.')
                t[i].ansc[j] = t[i].c[j] = '.';
        }
    }
    for (int i = 1; i <= n; i++) {
        t[i].solve();
        if (!t[i].vis1) {
            printf("No\n");
            continue;
        }
        printf("Yes\n");

        for (int j = 1; j <= m; j++) {
            if (t[i].ansc[j] == '.') {
                printf(".\n");
            }
            if (t[i].ansc[j] == '+') {
                printf("+ %d/%d\n", t[i].ansx[j], t[i].ansy[j]);
            }
            if (t[i].ansc[j] == '-') {
                printf("- %d\n", t[i].ansx[j]);
            }
        }
    }
}
int main() {
    solve();
}
// 1 13
// 7 951
// + 1/6
// ? 3 4
// + 4/183
// - 2
// + 3/217
// .
// .
// .
// + 2/29
// + 1/91
// .
// + 1/22
// .

// 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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3880kb

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: 0
Accepted
time: 0ms
memory: 4320kb

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
.
.
.
.
.
.
.
.
.
.
.
.
.
Yes
- 22
- 8
- 6
+ 1/173
- 11
- 9
- 3
- 6
+ 6/25...

result:

ok ok (1000 test cases)

Test #4:

score: 0
Accepted
time: 3ms
memory: 4332kb

input:

1000 13
0 0
.
.
.
- 1
.
- 5
.
- 2
- 2
- 1
- 9
- 2
.
0 0
- 7
- 1
? 2 2
- 2
- 4
.
- 1
- 3
- 6
- 1
? 4 6
.
- 1
2 480
+ 4/120
- 3
- 5
.
- 11
- 1
- 4
- 4
- 3
? 13 22
.
+ 9/140
? 1 5
3 465
.
.
.
+ 1/124
.
+ 1/139
.
.
+ 1/202
.
.
.
.
3 885
- 1
- 4
- 4
+ 4/158
.
+ 9/138
? 1 8
.
? 1 3
.
- 4
? 2 5
.
6 970
- 4...

output:

Yes
.
.
.
- 1
.
- 5
.
- 2
- 2
- 1
- 9
- 2
.
Yes
- 7
- 1
- 2
- 2
- 4
.
- 1
- 3
- 6
- 1
- 6
.
- 1
Yes
+ 4/120
- 3
- 5
.
- 11
- 1
- 4
- 4
- 3
- 22
.
+ 9/140
- 5
Yes
.
.
.
+ 1/124
.
+ 1/139
.
.
+ 1/202
.
.
.
.
Yes
- 1
- 4
- 4
+ 4/158
.
+ 9/138
- 8
.
- 3
.
- 4
+ 5/289
.
No
Yes
- 2
+ 1/205
- 1
+ 1/106
- 1...

result:

ok ok (1000 test cases)

Test #5:

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

input:

1000 13
5 1620
- 2
- 1
? 2 4
? 4 5
+ 6/213
.
+ 6/231
? 2 4
+ 7/215
.
.
? 2 6
? 1 1
2 975
? 1 4
- 2
- 6
.
? 2 12
? 1 4
? 2 7
- 3
- 1
? 2 19
? 2 2
- 2
? 1 1
0 0
.
.
- 3
- 1
.
- 1
- 4
.
- 1
.
- 1
- 1
- 3
4 1342
.
- 6
- 2
- 4
- 8
- 6
+ 14/95
? 2 2
? 1 9
? 6 10
- 7
+ 4/205
? 3 5
5 1019
.
.
.
+ 2/116
.
- ...

output:

Yes
- 2
- 1
+ 4/299
+ 3/242
+ 6/213
.
+ 6/231
- 4
+ 7/215
.
.
- 6
- 1
Yes
+ 4/299
- 2
- 6
.
- 12
- 4
- 7
- 3
- 1
+ 19/256
- 2
- 2
- 1
Yes
.
.
- 3
- 1
.
- 1
- 4
.
- 1
.
- 1
- 1
- 3
Yes
.
- 6
- 2
- 4
- 8
- 6
+ 14/95
+ 2/299
+ 9/243
- 10
- 7
+ 4/205
- 5
Yes
.
.
.
+ 2/116
.
- 1
+ 3/127
.
.
+ 1/275
+ 4/1...

result:

ok ok (1000 test cases)

Test #6:

score: 0
Accepted
time: 3ms
memory: 4320kb

input:

1000 13
0 0
.
.
.
.
- 1
.
? 1 4
.
.
- 1
.
.
- 1
5 1008
- 2
- 2
.
+ 4/157
.
.
+ 2/145
- 3
+ 2/125
.
+ 1/233
+ 4/188
- 5
0 0
.
.
? 1 1
.
.
.
.
.
.
.
.
.
.
6 1359
+ 1/100
+ 2/144
- 4
+ 2/238
- 2
- 2
+ 4/107
+ 4/214
.
? 3 6
+ 9/236
- 4
- 6
8 3064
+ 20/155
.
- 17
- 11
? 9 10
? 11 30
- 1
? 6 13
+ 6/113
+ ...

output:

Yes
.
.
.
.
- 1
.
- 4
.
.
- 1
.
.
- 1
Yes
- 2
- 2
.
+ 4/157
.
.
+ 2/145
- 3
+ 2/125
.
+ 1/233
+ 4/188
- 5
Yes
.
.
- 1
.
.
.
.
.
.
.
.
.
.
Yes
+ 1/100
+ 2/144
- 4
+ 2/238
- 2
- 2
+ 4/107
+ 4/214
.
- 6
+ 9/236
- 4
- 6
Yes
+ 20/155
.
- 17
- 11
+ 5/242
+ 20/240
- 1
- 13
+ 6/113
+ 2/221
+ 4/240
+ 12/151
...

result:

ok ok (1000 test cases)

Test #7:

score: 0
Accepted
time: 3ms
memory: 4204kb

input:

1000 13
2 501
? 1 8
- 1
+ 4/208
- 5
- 1
- 19
+ 4/173
- 11
.
- 11
? 1 1
.
- 10
4 599
- 2
.
- 12
.
+ 1/142
+ 3/85
- 3
? 4 8
+ 4/80
.
- 1
.
+ 3/152
13 3774
? 2 7
? 2 3
+ 12/162
+ 2/112
+ 4/174
+ 12/156
+ 2/163
+ 2/168
+ 12/186
+ 6/191
+ 8/43
? 1 2
? 1 16
8 2408
? 2 5
? 1 1
? 6 14
+ 4/204
.
+ 2/97
+ 2/2...

output:

Yes
- 8
- 1
+ 4/208
- 5
- 1
- 19
+ 4/173
- 11
.
- 11
- 1
.
- 10
Yes
- 2
.
- 12
.
+ 1/142
+ 3/85
- 3
- 8
+ 4/80
.
- 1
.
+ 3/152
No
Yes
+ 5/299
+ 1/299
+ 11/244
+ 4/204
.
+ 2/97
+ 2/222
+ 10/230
.
- 7
.
- 1
+ 2/233
Yes
.
- 8
- 4
- 4
- 2
.
- 7
.
.
- 10
- 5
- 3
- 4
Yes
+ 5/293
+ 1/173
.
- 2
- 1
+ 5/238
...

result:

ok ok (1000 test cases)

Test #8:

score: -100
Time Limit Exceeded

input:

1000 13
1 19917
? 30 39
? 79 81
? 32 33
? 35 95
? 14 84
? 6 17
? 11 31
? 5 8
? 34 89
? 38 50
? 10 10
? 22 54
? 5 92
1 16730
? 56 59
? 40 55
? 42 54
? 5 9
? 65 79
? 7 11
? 25 34
? 2 10
? 29 51
? 2 7
? 39 48
? 4 67
? 24 36
8 17772
? 17 35
? 36 46
? 42 63
? 2 11
? 59 84
? 4 36
? 9 21
? 76 86
? 48 89
? ...

output:


result: