-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patharrayofdiscord.cpp
More file actions
48 lines (44 loc) · 865 Bytes
/
arrayofdiscord.cpp
File metadata and controls
48 lines (44 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> v(n);
for (auto &x : v)
cin >> x;
bool ok = false;
for (int i = 1; i < n; ++i) {
if (v[i - 1].length() == v[i].length()) {
if (v[i].length() == 1) {
if (v[i][0] != '9') {
v[i - 1][0] = '9';
ok = true;
break;
} else if (v[i - 1][0] != '0') {
v[i][0] = '0';
ok = true;
break;
}
} else {
if (v[i][0] != '9') {
v[i - 1][0] = '9';
ok = true;
break;
} else if (v[i - 1][0] != '1') {
v[i][0] = '1';
ok = true;
break;
}
}
}
}
if (!ok)
cout << "impossible";
else {
for (auto x : v)
cout << x << " ";
}
return 0;
}