結果

問題 No.1279 Array Battle
ユーザー kotatsugame
提出日時 2020-11-07 23:48:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 606 ms
コンパイル使用メモリ 79,276 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-22 14:56:21
合計ジャッジ時間 1,294 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
int N;
int A[9],B[9],id[9];
main()
{
	cin>>N;
	map<int,int>mp;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++)cin>>B[i];
	for(int i=0;i<N;i++)id[i]=i;
	do{
		int ans=0;
		for(int i=0;i<N;i++)ans+=max(0,A[id[i]]-B[i]);
		mp[ans]++;
	}while(next_permutation(id,id+N));
	cout<<(--mp.end())->second<<endl;
}
0