为什么RE @root

lyhldy CSP-J2二等 2024-02-13 16:27:41 20
#include <bits/stdc++.h>
using namespace std;
bool a[1145141] = {};
int main() {
    int n, m, sum = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> m;
        if (a[m] != 1) {
            a[m] = 1;
            sum++;
        }
    }
    cout << sum << endl;
    for (int j = 1; j <= 1145141; j++) {
        if (a[j])
            cout << j << " ";
    }
    return 0;
}
{{ vote && vote.total.up }}

共 2 条回复

lyhldy CSP-J2二等

感谢站长大大qwq

root 站长

bool a[1145141] = {}; 数组的下标从0开始的