QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#709619 | #3322. Array of Discord | becaido | WA | 0ms | 3624kb | C++20 | 1.1kb | 2024-11-04 15:54:07 | 2024-11-04 15:54:13 |
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] << " \n"[k == n];
return;
}
}
}
}
cout << "impossible\n";
}
int main() {
Waimai;
solve();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
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'