QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#694092 | #5140. Frozen Scoreboard | Maxduan# | WA | 8ms | 3860kb | C++17 | 3.1kb | 2024-10-31 17:15:36 | 2024-10-31 17:15:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
void solve() {
int n, m;
cin >> n >> m;
for (int _ = 0; _ < n; _++) {
int pass, score;
cin >> pass >> score;
string op;
vector<string> inp;
vector<pair<int,int>> q;
vector<int>pos;
for (int j = 0; j < m; j++) {
cin >> op;
if (op == "+") {
int cnt = 0;
int time = 0;
string s;
cin >> s;
inp.push_back(op + " " + s); // 记录
bool flag = 0;
for (auto c : s) {
if (c == '/') {
flag = 1;
continue;
}
if (flag == 0) {
cnt = cnt * 10 + (c - '0');
} else {
time = time * 10 + (c - '0');
}
}
score -= (cnt - 1) * 20 + time;
pass--;
}
else if (op == "-") {
string s;
cin >> s;
inp.push_back(op + " " + s); // 记录
} else if (op == "?") {
int s1, s2;
cin >> s1 >> s2;
s1--,s2--;
q.push_back({s1,s2});
pos.push_back(j);
inp.push_back(op);
} else if (op == ".") {
inp.push_back(op);
}
}
score -= pass*240;
//cout<<"score="<<score<<'\n';
int N=q.size();
bool flag=0;
for(int i=0;i<(1<<N);i++){
if(__builtin_popcount(i)!=pass)continue;
int S=score;
for(int j=0;j<N;j++){
if(i>>j&1){
auto [x,y]=q[j];
S-=20*(y-x);
}
}
if(S<0)continue;
int cnt=S/20;
for(int j=0;j<N;j++){
if(i>>j&1){
auto [x,y]=q[j];
cnt-=x;
}
}
if(cnt>pass*59)continue;
for(int j=0;j<N;j++){
auto [x,y]=q[j];
if(i>>j&1){
int tmp=y-x;
int tp=min(x,S/20);
S-=20*tp;
int mm=min(S,59);
S-=mm;
inp[pos[j]]="+ "+to_string(tmp+tp+1)+'/'+to_string(mm+240);
}
else{
inp[pos[j]]="- "+to_string(y+1);
}
}
flag=1;
break;
}
if(!flag){
cout<<"No\n";
continue;
}
cout<<"Yes\n";
for (int i = 0; i < m; i++) {
cout << inp[i] << endl;
}
}
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
t = 1;
for (int i = 0; i < t; i++) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3860kb
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: 3640kb
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: -100
Wrong Answer
time: 8ms
memory: 3572kb
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:
wrong answer wrong total time (test case 13)