結果

問題 No.241 出席番号(1)
ユーザー syoken_desukasyoken_desuka
提出日時 2015-07-11 00:00:05
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,723 bytes
コンパイル時間 3,159 ms
コンパイル使用メモリ 86,624 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-22 10:27:47
合計ジャッジ時間 5,344 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1 ms
4,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:69:8: warning: extra tokens at end of #endif directive [-Wendif-labels]
 #endif _DEBUG
        ^~~~~~
main.cpp:78:8: warning: extra tokens at end of #endif directive [-Wendif-labels]
 #endif _DEBUG
        ^~~~~~

ソースコード

diff #

#include <algorithm>
#include <array>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <ostream>
#include<complex>
#include <cmath>
#include <iostream>
#include <stack>
#include <fstream>
#include <queue>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <string>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define ALLOF(c) (c),begin(), (c),end()
typedef long long ll;


int main()
{ 
    int n;
    int a[50];
    int hate_count[50];
    int dispatched[50];
    fill(dispatched,dispatched + 50, -1);
    fill(hate_count,hate_count+50, 0);
    cin >> n;

    rep(i,n)
    {
        cin >> a[i];
    }
    rep(i,n)
    {
        hate_count[a[i]]++;
    }
    rep(i,n)
    {
        int need_dispatch = 0;
        int tmp_c = -1;
        rep(j,n)
        {
            if (tmp_c < hate_count[j])
            {
                if(hate_count[i] == n)
                {
                    cout << -1 << endl;
                    return 0;
                }
                need_dispatch = j;
                tmp_c = hate_count[j];
            }
        }

#ifdef _DEBUG
        cout << tmp_c << "  " << need_dispatch << endl;
#endif _DEBUG      

        rep(j,n)
        {
            if (dispatched[j] == -1 && a[j] != need_dispatch)
            {

#ifdef _DEBUG
                cout << "dispatched in" << j << endl;
#endif _DEBUG      

                dispatched[j] = need_dispatch;
                break;
            }
        }
    }
    rep(i,n)
    {
        cout << dispatched[i] << endl;
    }
    return 0;
}
0