結果

問題 No.241 出席番号(1)
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2022-12-29 05:28:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 772 bytes
コンパイル時間 1,012 ms
コンパイル使用メモリ 117,612 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-03 08:52:08
合計ジャッジ時間 3,569 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
6,944 KB
testcase_04 WA -
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 WA -
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 WA -
testcase_23 AC 2 ms
6,944 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 2 ms
6,944 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 WA -
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<int> A(N);
    set<int> st, st2;
    for (int i=0; i<N; i++) st.insert(i);
    for (int i=0; i<N; i++){
        cin >> A[i];
        st.erase(A[i]);
    }

    if (st.size() == N-1){
        cout << -1 << endl;
        return 0;
    }

    for (int i=0; i<N; i++){
        if (st2.count(A[i])){
            A[i] = *st.begin();
            st.erase(st.begin());
        }
        else st2.insert(A[i]);
    }

    for (int i=0; i<N; i++) cout << (A[i]+1) % N << endl;

    return 0;
}
0