Submission #995592
Source Code Expand
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; long long cnt[12][10], cnt2[12][10], Ktw[12]; long long dp[1000][10000], sum = 0, power[12]; void solve(int y) { vector<int>vec; for (int i = 0; i < 10; i++) { for (int j = 0; j < min(50LL, cnt[y][i]); j++)vec.push_back(i); } for (int i = 0; i < 500; i++) { for (int j = 0; j < 5000; j++)dp[i][j] = 0; } dp[0][0] = 1; for (int i = 0; i < vec.size(); i++) { for (int j = 0; j < 5000; j++) { if (dp[i][j] == 0)continue; dp[i + 1][j] = 1; dp[i + 1][j + vec[i]] = 1; } } for (int i = 0; i < 5000; i++) { if (dp[vec.size()][i] == 1)cnt2[y][i % 10] = 1; } } int main() { int n; cin >> n; power[0] = 1; for (int i = 1; i < 12; i++)power[i] = power[i - 1] * 10; for (int i = 0; i < n; i++) { string S; cin >> S; while (S.size() < 12)S = '0' + S; for (int j = 0; j < 12; j++) { cnt[11 - j][S[j] - '0']++; Ktw[11 - j] += (S[j] - '0'); } } for (int i = 0; i < 12; i++)solve(i); long long maxn = 0; for (int i = 0; i < 12; i++) { int sumn = 0; for (int j = 0; j <= (maxn / power[i]); j++) { for (int k = 0; k < 10; k++) { if (cnt2[i][k] == 1)sumn = max(sumn, (j + k) % 10); } } sum += sumn; maxn += Ktw[i] * power[i]; } cout << sum << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Exact Payment |
User | E869120 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1345 Byte |
Status | WA |
Exec Time | 97 ms |
Memory | 21888 KB |
Judge Result
Set Name | sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1500 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
All | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt, 01-44.txt, 01-45.txt, 01-46.txt, 01-47.txt, 01-48.txt, 01-49.txt, 01-50.txt, 01-51.txt, 01-52.txt, 01-53.txt, 01-54.txt, 01-55.txt, 01-56.txt, 01-57.txt, 01-58.txt, 01-59.txt, 01-60.txt, 01-61.txt, 01-62.txt, 01-63.txt, 01-64.txt, 01-65.txt, 01-66.txt, 01-67.txt, 01-68.txt, 01-69.txt, 01-70.txt, 01-71.txt, 01-72.txt, 01-73.txt, 01-74.txt, 01-75.txt, 01-76.txt, 01-77.txt, 01-78.txt, 01-79.txt, 01-80.txt, 01-81.txt, 01-82.txt, 01-83.txt, 01-84.txt, 01-85.txt, 01-86.txt, 01-87.txt, 01-88.txt, 01-89.txt, 01-90.txt, 01-91.txt, 01-92.txt, 01-93.txt, 01-94.txt, 01-95.txt, 01-96.txt, 01-97.txt, 01-98.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 49 ms | 21760 KB |
01-02.txt | WA | 51 ms | 21760 KB |
01-03.txt | WA | 51 ms | 21760 KB |
01-04.txt | WA | 51 ms | 21760 KB |
01-05.txt | WA | 52 ms | 21760 KB |
01-06.txt | WA | 97 ms | 21888 KB |
01-07.txt | WA | 94 ms | 21888 KB |
01-08.txt | WA | 91 ms | 21888 KB |
01-09.txt | WA | 94 ms | 21888 KB |
01-10.txt | WA | 83 ms | 21888 KB |
01-11.txt | WA | 86 ms | 21888 KB |
01-12.txt | WA | 92 ms | 21888 KB |
01-13.txt | WA | 94 ms | 21888 KB |
01-14.txt | WA | 95 ms | 21888 KB |
01-15.txt | WA | 94 ms | 21888 KB |
01-16.txt | WA | 96 ms | 21888 KB |
01-17.txt | WA | 85 ms | 21888 KB |
01-18.txt | WA | 85 ms | 21888 KB |
01-19.txt | WA | 86 ms | 21888 KB |
01-20.txt | WA | 84 ms | 21888 KB |
01-21.txt | WA | 83 ms | 21888 KB |
01-22.txt | WA | 83 ms | 21888 KB |
01-23.txt | WA | 86 ms | 21888 KB |
01-24.txt | WA | 84 ms | 21888 KB |
01-25.txt | WA | 83 ms | 21888 KB |
01-26.txt | WA | 83 ms | 21888 KB |
01-27.txt | WA | 86 ms | 21888 KB |
01-28.txt | WA | 82 ms | 21888 KB |
01-29.txt | WA | 82 ms | 21888 KB |
01-30.txt | WA | 85 ms | 21888 KB |
01-31.txt | WA | 84 ms | 21888 KB |
01-32.txt | WA | 82 ms | 21888 KB |
01-33.txt | WA | 84 ms | 21888 KB |
01-34.txt | WA | 84 ms | 21888 KB |
01-35.txt | WA | 85 ms | 21888 KB |
01-36.txt | WA | 83 ms | 21888 KB |
01-37.txt | WA | 84 ms | 21888 KB |
01-38.txt | WA | 85 ms | 21888 KB |
01-39.txt | WA | 83 ms | 21888 KB |
01-40.txt | WA | 84 ms | 21888 KB |
01-41.txt | WA | 84 ms | 21888 KB |
01-42.txt | WA | 83 ms | 21888 KB |
01-43.txt | WA | 91 ms | 21888 KB |
01-44.txt | WA | 84 ms | 21888 KB |
01-45.txt | WA | 84 ms | 21888 KB |
01-46.txt | WA | 86 ms | 21888 KB |
01-47.txt | WA | 87 ms | 21888 KB |
01-48.txt | WA | 86 ms | 21888 KB |
01-49.txt | WA | 84 ms | 21888 KB |
01-50.txt | WA | 85 ms | 21888 KB |
01-51.txt | WA | 90 ms | 21888 KB |
01-52.txt | WA | 87 ms | 21888 KB |
01-53.txt | WA | 86 ms | 21888 KB |
01-54.txt | WA | 86 ms | 21888 KB |
01-55.txt | WA | 87 ms | 21888 KB |
01-56.txt | WA | 86 ms | 21888 KB |
01-57.txt | WA | 86 ms | 21888 KB |
01-58.txt | WA | 86 ms | 21888 KB |
01-59.txt | WA | 85 ms | 21888 KB |
01-60.txt | WA | 85 ms | 21888 KB |
01-61.txt | WA | 84 ms | 21888 KB |
01-62.txt | WA | 84 ms | 21888 KB |
01-63.txt | WA | 84 ms | 21888 KB |
01-64.txt | WA | 86 ms | 21888 KB |
01-65.txt | WA | 86 ms | 21888 KB |
01-66.txt | WA | 68 ms | 21760 KB |
01-67.txt | WA | 69 ms | 21760 KB |
01-68.txt | WA | 69 ms | 21760 KB |
01-69.txt | WA | 68 ms | 21760 KB |
01-70.txt | WA | 69 ms | 21760 KB |
01-71.txt | WA | 68 ms | 21760 KB |
01-72.txt | WA | 67 ms | 21760 KB |
01-73.txt | WA | 70 ms | 21760 KB |
01-74.txt | WA | 73 ms | 21760 KB |
01-75.txt | WA | 70 ms | 21760 KB |
01-76.txt | WA | 70 ms | 21760 KB |
01-77.txt | WA | 68 ms | 21760 KB |
01-78.txt | WA | 69 ms | 21760 KB |
01-79.txt | WA | 70 ms | 21760 KB |
01-80.txt | WA | 68 ms | 21760 KB |
01-81.txt | WA | 69 ms | 21760 KB |
01-82.txt | WA | 69 ms | 21760 KB |
01-83.txt | WA | 71 ms | 21760 KB |
01-84.txt | WA | 69 ms | 21760 KB |
01-85.txt | WA | 69 ms | 21760 KB |
01-86.txt | WA | 68 ms | 21760 KB |
01-87.txt | WA | 70 ms | 21760 KB |
01-88.txt | WA | 70 ms | 21760 KB |
01-89.txt | WA | 69 ms | 21760 KB |
01-90.txt | WA | 72 ms | 21760 KB |
01-91.txt | WA | 69 ms | 21760 KB |
01-92.txt | WA | 70 ms | 21760 KB |
01-93.txt | WA | 70 ms | 21760 KB |
01-94.txt | WA | 69 ms | 21760 KB |
01-95.txt | WA | 69 ms | 21760 KB |
01-96.txt | WA | 69 ms | 21760 KB |
01-97.txt | WA | 69 ms | 21760 KB |
01-98.txt | WA | 67 ms | 21760 KB |
sample-01.txt | WA | 51 ms | 21760 KB |
sample-02.txt | WA | 51 ms | 21760 KB |