QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#219074 | #5140. Frozen Scoreboard | 4k2kok | WA | 3ms | 3632kb | C++20 | 3.7kb | 2023-10-18 23:38:14 | 2023-10-18 23:38:14 |
Judging History
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};
}
}
// for(int i = 0; i < m; i++) {
// cout << vv[i][0] << " " << vv[i][1] << " " << vv[i][2] << '\n';
// }
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;
if(T <= a * 59) {
for (auto k: now) {
int num = min(T, 59);
ans[k[0]][0] = 0;
ans[k[0]][1] = k[1] + 1;
ans[k[0]][2] = num + 240;
T -= num;
}
flag = 1;
break;
}
int cc = T - a * 59;
int needpan = ceil(1.0 * cc / 20);
if(needpan > totpan) continue;
int nem = T - needpan * 20;
for (auto k: now) {
int num = min(nem, 59);
ans[k[0]][0] = 0;
ans[k[0]][2] = num + 240;
nem -= num;
}
for (auto k : now) {
int num = min(needpan, k[2] - 1);
ans[k[0]][1] = k[1] + num + 1;
needpan -= num;
}
flag = 1;
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();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
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: 3560kb
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: 3632kb
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 wrong total time (test case 13)