QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#709624 | #3322. Array of Discord | becaido | WA | 0ms | 3632kb | C++20 | 1.2kb | 2024-11-04 15:56:08 | 2024-11-04 15:56:08 |
Judging History
answer
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for(int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second
const int SIZE = 105;
int n;
ll a[SIZE];
string s[SIZE];
ll f(string s) {
ll x = 0;
for (char c : s) x = 10 * x + c - '0';
return x;
}
bool check() {
FOR (i, 1, n - 1) if (a[i] > a[i + 1]) return 1;
return 0;
}
void solve() {
cin >> n;
FOR (i, 1, n) cin >> s[i];
FOR (i, 1, n) {
FOR (j, 1, n) a[j] = f(s[j]);
FOR (j, 0, s[i].size() - 1) {
string t = s[i];
char l = '0', r = '9';
if (s[i].size() > 1 && j == 0) l = '1';
FOR (c, l, r) {
t[j] = c;
a[i] = f(t);
if (check()) {
FOR (k, 1, n) cout << a[k] << ' ';
cout << '\n';
return;
}
}
}
}
cout << "impossible\n";
}
int main() {
Waimai;
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3632kb
input:
10 0 1 2 3 4 5 6 7 8 9
output:
2 1 2 3 4 5 6 7 8 9
result:
wrong answer 1st lines differ - expected: '9 1 2 3 4 5 6 7 8 9', found: '2 1 2 3 4 5 6 7 8 9 '