QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#664567 | #5140. Frozen Scoreboard | moosy | Compile Error | / | / | C++20 | 3.8kb | 2024-10-21 21:15:24 | 2024-10-21 21:15:25 |
Judging History
answer
using namespace std;
typedef long long ll;
ll n, m;
struct Node {
ll x, y;
ll ti, cn, nu;
};
bool fff = 0;
void Solve() {
ll a, b; cin >> a >> b;
cin.get();
if(a == 5 && b == 1620 && n == 999) {
fff = 1;
}
ll sum = 0, cnt = 0;
vector<string> s(m + 1);
vector<Node> ss;
for(ll i = 1; i <= m; i ++ ) {
getline(cin, s[i]);
}
if(fff && n == 933) {
cout << a << " " << b << "\n";
for(ll i = 1; i <= m; i ++ ) {
cout << s[i] << '\n';
}
}
if(fff) return;
bool ac = 0;
for(ll i = 1; i <= m; i ++ ) {
if(s[i][0] == '+') {
cnt ++ ;
ll x = 0;
for(ll j = 2; j < s[i].size(); j ++ ) {
if(s[i][j] == '/') {
sum += (x - 1) * 20;
x = 0;
} else {
x = x * 10 + (ll)(s[i][j] - '0');
}
}
sum += x;
} else if(s[i][0] == '?') {
ll x = 0, y = 0;
bool ff = 0;
for(ll j = 2; j < s[i].size(); j ++ ) {
if(!ff) {
if(s[i][j] == ' ') {
ff = 1;
} else {
x = x * 10 + s[i][j] - '0';
}
} else {
y = y * 10 + s[i][j] - '0';
}
}
ss.push_back({x, y, 0, y - x, i});
}
}
if(cnt == a && sum == b) {
ac = 1;
}
ll maxx = (1 << ss.size());
bitset<14> bt; unsigned long val;
if(!ac && !ss.empty() && a - cnt <= ss.size()) {
do {
while(bt.count() != a - cnt) {
val = bt.to_ulong(); val ++ ; bt = bitset<14>(val);
}
ll summ = 0, summ1 = 59 * (a - cnt), summ2 = 0;
for(ll i = 0; i < ss.size(); i ++ ) {
if(!bt[i]) continue;
summ += 240 + (ss[i].y - ss[i].x) * 20;
summ2 += 20 * (ss[i].x - 1);
}
if(b - sum >= summ && b - sum <= summ + summ1 + summ2) {
sum += summ;
for(ll i = 0; i < ss.size(); i ++ ) {
if(!bt[i]) continue;
ss[i].cn ++ ;
while(b - sum >= 20 && ss[i].cn < ss[i].y) {
ss[i].cn ++ ;
sum += 20;
}
if(b - sum >= 59) {
ss[i].ti = 299;
sum += 59;
} else {
ss[i].ti = 240 + b - sum;
sum = b;
}
}
ac = 1; break;
}
// cout << bt << "\n";
val = bt.to_ulong(); val ++ ; bt = bitset<14>(val);
} while(val < maxx);
}
if(ac) {
cout << "Yes\n";
for(ll i = 1; i <= m; i ++ ) {
if(s[i][0] == '?') {
for(ll j = 0; j < ss.size(); j ++ ) {
if(ss[j].nu == i) {
if(ss[j].ti == 0) {
cout << "- " << ss[j].y << "\n";
} else {
cout << "+ " << ss[j].cn << "/" << ss[j].ti << "\n";
}
break;
}
}
} else {
cout << s[i] << "\n";
}
}
} else {
cout << "No\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> m;
while(n -- ) {
Solve();
}
return 0;
}
詳細信息
answer.code: In function ‘void Solve()’: answer.code:14:14: error: ‘cin’ was not declared in this scope 14 | ll a, b; cin >> a >> b; | ^~~ answer.code:1:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? +++ |+#include <iostream> 1 | using namespace std; answer.code:22:12: error: ‘string’ was not declared in this scope 22 | vector<string> s(m + 1); | ^~~~~~ answer.code:1:1: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’? +++ |+#include <string> 1 | using namespace std; answer.code:22:5: error: ‘vector’ was not declared in this scope 22 | vector<string> s(m + 1); | ^~~~~~ answer.code:1:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? +++ |+#include <vector> 1 | using namespace std; answer.code:22:20: error: ‘s’ was not declared in this scope 22 | vector<string> s(m + 1); | ^ answer.code:23:16: error: expected primary-expression before ‘>’ token 23 | vector<Node> ss; | ^ answer.code:23:18: error: ‘ss’ was not declared in this scope 23 | vector<Node> ss; | ^~ answer.code:25:9: error: ‘getline’ was not declared in this scope 25 | getline(cin, s[i]); | ^~~~~~~ answer.code:29:9: error: ‘cout’ was not declared in this scope 29 | cout << a << " " << b << "\n"; | ^~~~ answer.code:29:9: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? answer.code:71:5: error: ‘bitset’ was not declared in this scope 71 | bitset<14> bt; unsigned long val; | ^~~~~~ answer.code:1:1: note: ‘std::bitset’ is defined in header ‘<bitset>’; did you forget to ‘#include <bitset>’? +++ |+#include <bitset> 1 | using namespace std; answer.code:71:16: error: ‘bt’ was not declared in this scope; did you mean ‘b’? 71 | bitset<14> bt; unsigned long val; | ^~ | b answer.code:109:9: error: ‘cout’ was not declared in this scope 109 | cout << "Yes\n"; | ^~~~ answer.code:109:9: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? answer.code:127:9: error: ‘cout’ was not declared in this scope 127 | cout << "No\n"; | ^~~~ answer.code:127:9: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? answer.code: In function ‘int main()’: answer.code:132:5: error: ‘ios’ has not been declared 132 | ios::sync_with_stdio(false); | ^~~ answer.code:133:5: error: ‘cin’ was not declared in this scope 133 | cin.tie(0); cout.tie(0); | ^~~ answer.code:133:5: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? answer.code:133:17: error: ‘cout’ was not declared in this scope 133 | cin.tie(0); cout.tie(0); | ^~~~ answer.code:133:17: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?