結果
| 問題 |
No.120 傾向と対策:門松列(その1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-07-29 08:34:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 620 bytes |
| コンパイル時間 | 778 ms |
| コンパイル使用メモリ | 68,852 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-06 18:20:00 |
| 合計ジャッジ時間 | 1,597 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 4 |
ソースコード
#include <iostream>
#include <map>
using namespace std;
int main(){
int t,n,l;
cin>>t;
for(int i=0; i<t; ++i){
cin>>n;
map<int,int> m;
for(int j=0; j<n; ++j){
cin>>l;
map<int,int>::iterator it=m.find(l);
if(it!=m.end()){
m[l]++;
} else {
m.insert(make_pair(l,1));
}
}
int a;
a=n/3;
int b;
b=0;
map<int,int>::iterator it;
for(it=m.begin(); it!=m.end(); ++it){
int c;
c=it->second;
if(c>a){
int d;
d=c-a;
b+=d;
}
}
int x;
x=(n-b)/3;
cout<<x<<endl;
}
return 0;
}