Submission #1866353
Source Code Expand
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> v; while (n) { v.push_back(n % 10); n /= 10; } v.push_back(0); reverse(v.begin(), v.end()); bool d[10]; for (int i = 0; i < 10; i++) d[i] = true; for (int i = 0; i < k; i++) { int a; cin >> a; d[a] = false; } int m = 10; int M = 10; for (int i = 0; i < 10; i++) { if (d[i] && m == 10) { m = i; } if (d[i] && i > 0) { M = i; break; } } for (int i = 1; i < v.size(); i++) { int a = v[i]; if (d[a]) continue; for (int j = a; j < a + 10; j++) { if (d[j % 10]) { int b = j % 10; v[i] = b; if (b < a) { v[i - 1] = M; } break; } } for (int j = i + 1; j < v.size(); j++) v[j] = m; break; } if (v[0]) cout << v[0]; for (int i = 1; i < v.size(); i++) { cout << v[i]; } cout << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - Iroha and Haiku (ABC Edition) |
User | abeaumont |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 956 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_sample_01.txt, subtask0_sample_02.txt |
All | subtask0_sample_01.txt, subtask0_sample_02.txt, subtask1_X_575.txt, subtask1_X_577.txt, subtask1_X_755.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask0_sample_01.txt | WA | 1 ms | 256 KB |
subtask0_sample_02.txt | WA | 1 ms | 256 KB |
subtask1_X_575.txt | WA | 1 ms | 256 KB |
subtask1_X_577.txt | WA | 1 ms | 256 KB |
subtask1_X_755.txt | WA | 1 ms | 256 KB |