QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#709600#3322. Array of DiscordbecaidoWA 0ms3780kbC++201.1kb2024-11-04 15:43:172024-11-04 15:43:21

Judging History

你现在查看的是最新测评结果

  • [2024-11-04 15:43:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3780kb
  • [2024-11-04 15:43:17]
  • 提交

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: 3780kb

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'