結果
| 問題 |
No.241 出席番号(1)
|
| コンテスト | |
| ユーザー |
syoken_desuka
|
| 提出日時 | 2015-07-11 00:00:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,723 bytes |
| コンパイル時間 | 589 ms |
| コンパイル使用メモリ | 89,248 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-08 02:24:32 |
| 合計ジャッジ時間 | 4,622 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 5 WA * 24 |
コンパイルメッセージ
main.cpp:69:8: warning: extra tokens at end of #endif directive [-Wendif-labels]
69 | #endif _DEBUG
| ^~~~~~
main.cpp:78:8: warning: extra tokens at end of #endif directive [-Wendif-labels]
78 | #endif _DEBUG
| ^~~~~~
ソースコード
#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;
}
syoken_desuka