QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#648227 | #5140. Frozen Scoreboard | bhscer | WA | 0ms | 3612kb | C++17 | 6.1kb | 2024-10-17 17:46:13 | 2024-10-17 17:46:14 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define fadd(a,b,c) for (int a=b;a<=c;a++)
#define fsub(a,b,c) for (int a=b;a>=c;a--)
#define F first
#define S second
#define CYes cout << "Yes\n"
#define CNo cout << "No\n"
#define CYES cout << "YES\n"
#define CNO cout << "NO\n"
#define println(a) cout << (a) << '\n'
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
void fastIO(){ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
class bhscer {
public:
template<typename FIRST, typename ...PACK> static void debug(FIRST first, PACK... params) { std::cout<< first <<' '; debug(params...);}
template<typename T> static void debug(T end) { std::cout << end << std::endl; }
};
const int N = 2000;
int a[N];
int solveCnt[N];
int tTime[N];
enum BlockStatus {
NONE,
AC,
WA,
PEND
};
struct Block {
BlockStatus status;
int passTime;
int afterTry;
int allTry;
} bl[N][20];
bool impossible[N];
int count1(int x) {
return __builtin_popcount(x);
}
void solve() {
int n,m; cin >> n >> m;
for (int i=1;i<=n;i++) {
cin >> solveCnt[i] >> tTime[i];
int passCnt = 0;
int curTime = 0;
vector<int> possiblePros;char fuck = getchar();
for (int j=1;j<=m;j++) {
string s;
getline(cin,s);
// cout << "! "<< s << '\n';
if (s[0] == '.') {
bl[i][j].status = BlockStatus::NONE;
} else if (s[0] == '+') {
bl[i][j].status = BlockStatus::AC;
int l = 2;
int cur = 0;
while (s[l] != '/') {
cur = cur * 10 + (s[l] - '0');
l++;
}
bl[i][j].allTry = cur;
l++;
cur = 0;
while (l < s.size()) {
cur = cur * 10 + (s[l] - '0');
l++;
}
bl[i][j].passTime = cur;
passCnt++;
curTime += (bl[i][j].allTry - 1) * 20 + bl[i][j].passTime;
} else if (s[0] == '?') {
bl[i][j].status = BlockStatus::PEND;
int l = 2;
int cur = 0;
while (s[l] != ' ') {
cur = cur * 10 + (s[l] - '0');
l++;
}
cout << cur << endl;
bl[i][j].afterTry = cur;
l++;
cur = 0;
while (l < s.size()) {
cur = cur * 10 + (s[l] - '0');
l++;
}
bl[i][j].allTry = cur;
cout << cur << endl;
possiblePros.push_back(j);
} else if (s[0] == '-') {
bl[i][j].status = BlockStatus::WA;
int l = 2;
int cur = 0;
while (l < s.size()) {
cur = cur * 10 + (s[l] - '0');
l++;
}
bl[i][j].allTry = cur;
}
}
if (solveCnt[i] < passCnt || solveCnt[i] > passCnt + possiblePros.size()) {
impossible[i] = true;
// cout << " because count " << endl;
} else {
int shouldPass = solveCnt[i] - passCnt;
sort(possiblePros.begin(), possiblePros.end(), [&](int a, int b) {
auto x = bl[i][a];
auto y = bl[i][b];
return x.allTry < y.allTry;
});
bool ok = false;
for (int cas = 1 ; cas < 1 << possiblePros.size() ; cas++) {
if (count1(cas) == shouldPass) {
int mustFs = 0;
int minTime = 0;
int maxTime = 0;
for (int j=0;j<possiblePros.size();j++) {
if (cas & (1 << j)) {
mustFs += bl[i][possiblePros[j]].allTry - 1;
minTime += (bl[i][possiblePros[j]].allTry - bl[i][possiblePros[j]].afterTry - 1) * 20 + 240;
maxTime += (bl[i][possiblePros[j]].allTry - 1) * 20 + 240;
}
}
// cout << minTime << " " << tTime[i] - curTime << " " << maxTime << endl;
if (minTime <= tTime[i] - curTime && maxTime >= tTime[i] - curTime) {
int cTime = tTime[i] - curTime - minTime;
for (int j=0;j<possiblePros.size();j++) {
if (cas & (1 << j)) {
int curTry = min(bl[i][possiblePros[j]].afterTry, cTime / 20);
cTime -= curTry * 20;
bl[i][possiblePros[j]].status = BlockStatus::AC;
bl[i][possiblePros[j]].allTry = (bl[i][possiblePros[j]].allTry - bl[i][possiblePros[j]].afterTry + curTry);
bl[i][possiblePros[j]].passTime = min(cTime, 59ll);
}
}
ok = true;
} else {
impossible[i] = true;
// cout << " because time " << endl;
}
}
if (ok) break;
}
}
if (impossible[i]) {
CNo;
} else {
CYes;
for (int j=1;j<=m;j++) {
if (bl[i][j].status == BlockStatus::AC) {
cout << "+ " << bl[i][j].allTry << "/" << bl[i][j].passTime << '\n';
} else if (bl[i][j].status == BlockStatus::WA) {
cout << "- " << bl[i][j].allTry << '\n';
} else if (bl[i][j].status == BlockStatus::NONE){
cout << ".\n";
}
}
}
}
}
signed main() {
fastIO();
int _ = 1;
// cin >> _;
while (_--) {
solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3612kb
input:
1 13 7 951 + 1/6 ? 3 4 + 4/183 - 2 + 3/217 . . . + 2/29 + 1/91 . + 1/22 .
output:
3 4 Yes . + 1/6 + 3/3 + 4/183 - 2 + 3/217 . . . + 2/29 + 1/91 . + 1/22
result:
wrong answer Token parameter [name=yesno] equals to "3", doesn't correspond to pattern "Yes|No" (test case 1)