QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#103612 | #6300. Best Carry Player 2 | MIT01# | Compile Error | / | / | C++17 | 2.2kb | 2023-05-07 04:17:51 | 2023-05-07 04:17:53 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-05-07 04:17:53]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-05-07 04:17:51]
- 提交
answer
// #pragma GCC optimize("-Ofast","-ffast-math","-funroll-all-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll __int128
#define db double
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mod 998244353
#define vi vector<int>
const int maxn = 2000005;
const int S = 37;
template<typename T> bool chkmin(T &a, T b) {
return (b < a) ? (a = b, 1) : 0;
}
template<typename T> bool chkmax(T &a, T b) {
return (b > a) ? (a = b, 1) : 0;
}
ll dp[S + 2][3][S]; // next undet: i; j many <
int dig[S];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
ll x;
int k;
long long inp;
cin >> inp >> k;
x = inp;
for (int j = 0; j < S; j++) {
dig[j] = x % 10;
x /= 10;
}
ll inf = 3e18;
inf = inf * inf;
for (int i = 0; i < S + 2; i++)
for (int j = 0; j < 3; j++)
for (int k = 0; k < S; k++)
dp[i][j][k] = inf;
dp[0][1][0] = 0;
ll pw = 1;
for (int i = 0; i < S; i++) {
for (int u = 0; u < 3; u++)
for (int v = 0; v <= 18; v++) {
if (dp[i][u][v] > inf) continue;
for (int w = 0; w < 10; w++) {
// if (i == S - 1 && w >= 4) continue;
ll cc = dp[i][u][v] + w * pw;
int eu = 0, ev = v;
if (w > dig[i]) eu = 2;
else if (w == dig[i]) eu = u;
else eu = 0;
if (!eu) ev += 1;
chkmin(dp[i + 1][eu][ev], cc);
}
}
pw = pw * 10;
}
ll ans = dp[S][2][k] - stx;
vi otp;
while (ans) {
otp.pb(ans % 10);
ans /= 10;
}
reverse(otp.begin(), otp.end());
for (auto v : otp) printf("%d", v);
printf("\n");
// cout << ans << '\n';
// cout << dp[S][2][k] - stx << '\n';
}
return 0;
}
/*
4
12345678 0
12345678 5
12345678 18
990099 5
*/
Details
answer.code: In function ‘int main()’: answer.code:63:32: error: ‘stx’ was not declared in this scope; did you mean ‘std’? 63 | ll ans = dp[S][2][k] - stx; | ^~~ | std