QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#729511 | #5140. Frozen Scoreboard | yixuanoct# | WA | 0ms | 3664kb | C++20 | 2.4kb | 2024-11-09 17:15:06 | 2024-11-09 17:15:11 |
Judging History
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 bb = b;
int res = 0;
for (auto i : q) {
auto [_, tmp] = s[i];
auto [x, y] = tmp;
bb -= (y - x) * 20;
res += x - 1;
}
if (240 * a > bb || 299 * a + res * 20 < bb) return;
bb -= 240 * a;
int num = min(bb / 20, res);
bb -= 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 + bb <= 299) y = 240 + bb, bb = 0;
else y = 299, bb -= 59;
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();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3660kb
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: -100
Wrong Answer
time: 0ms
memory: 3664kb
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 Yes - 100 + 1/240 Yes + 89/240 - 100
result:
wrong answer wrong number of solved problems (test case 5)