QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#268245 | #5140. Frozen Scoreboard | catgok | WA | 0ms | 3696kb | C++14 | 4.4kb | 2023-11-28 14:16:13 | 2023-11-28 14:16:13 |
Judging History
answer
// 2023-11-28 12:34:27
#include <bits/stdc++.h>
#define x first
#define y second
#define ll long long
#define int long long
#define PII pair<int,int>
using namespace std;
const int N = 2e6 + 9, INF = 1e18;
int m;
struct problem {
string status;
int submit_cnt{}, submit_time{};
int try_cnt{};
int success_time{};
};
void solve() {
int final_pass_cnt, final_time;
vector<problem> p(m);
cin >> final_pass_cnt >> final_time;
for (int i = 0; i < m; i++) {
cin >> p[i].status;
// cout << p[i].status << " " << i << "\n";
if (p[i].status == ".") continue;
else if (p[i].status == "-") cin >> p[i].submit_cnt;
else if (p[i].status == "?") cin >> p[i].try_cnt >> p[i].submit_cnt;
else if (p[i].status == "+") {
scanf("%lld/%lld", &p[i].submit_cnt, &p[i].submit_time);
p[i].success_time = p[i].submit_time;
}
};
// for (int i = 0; i < m; i++) cout << p[i].status << "\n";
// cout << "\n";
// return;
for (int all_st = 0; all_st < (1 << m); all_st++) {
int ok = 1;
int time_l = 0, time_r = 0, pass_cnt = 0;
for (int j = 0; j < m; j++) {
if (((all_st >> j) & 1) == 1) { // pass
if (p[j].status == "." || p[j].status == "-") ok = 0;
else if (p[j].status == "+") {
pass_cnt++;
int tmp = (p[j].submit_cnt - 1) * 20 + p[j].submit_time;
time_l += tmp;
time_r += tmp;
} else if (p[j].status == "?") {
pass_cnt++;
int tmpl = 240 + (p[j].submit_cnt - p[j].try_cnt) * 20;
int tmpr = 299 + (p[j].submit_cnt - 1) * 20;
time_l += tmpl;
time_r += tmpr;
}
} else {
if (p[j].status == "+") ok = 0;
}
}
// if (all_st == 2839) {
// cout << "(((((((((\n";
// cout << ok;
// }
if (ok) {
if (final_pass_cnt == pass_cnt && time_l <= final_time && final_time <= time_r) {
cout << "Yes\n";
int calc_time = final_time - time_l;
// cout << time_l << " " << time_r << "\n";
for (int j = 0; j < m; j++) {
if (((all_st >> j) & 1) == 1) { // pass
if (p[j].status == "+") {
int tmp = (p[j].submit_cnt - 1) * 20 + p[j].submit_time;
cout << "+ " << p[j].submit_cnt << "/" << p[j].submit_time << "\n";
} else if (p[j].status == "?") {
int tmpl = 240 + (p[j].submit_cnt - p[j].try_cnt) * 20;
int tmpr = 299 + (p[j].submit_cnt - 1) * 20;
int det = tmpr - tmpl;
if (calc_time >= det) {
cout << "+ " << p[j].submit_cnt << "/" << 299 << "\n";
calc_time -= det;
} else {
if (calc_time <= 39) {
cout << "+ " << p[j].submit_cnt - p[j].try_cnt + 1 << "/" << 240 + calc_time
<< "\n";
calc_time = 0;
} else {
int r = calc_time % 20;
int k = (calc_time - 40) / 20;
cout << "+ " << p[j].submit_cnt + k + 1 << "/" << 280 + r << "\n";
calc_time = 0;
}
}
}
} else {
if (p[j].status == ".") cout << ".\n";
else if (p[j].status == "-") cout << "- " << p[j].submit_cnt << "\n";
else if (p[j].status == "?") cout << "- " << p[j].submit_cnt << "\n";
}
}
return;
}
}
}
cout << "No\n";
}
signed main() {
// freopen("z_in.txt", "r", stdin);
// ios::sync_with_stdio(false);
int T = 1;
cin >> T >> m;
// scanf("%lld%lld", &T, &m);
while (T--) solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
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: -100
Wrong Answer
time: 0ms
memory: 3696kb
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 + 187/280 - 100
result:
wrong answer submission should be between 1 and 100 (test case 6)