結果
問題 |
No.1279 Array Battle
|
ユーザー |
|
提出日時 | 2020-11-07 23:46:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 381 bytes |
コンパイル時間 | 608 ms |
コンパイル使用メモリ | 80,444 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-22 14:56:19 |
合計ジャッジ時間 | 1,336 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 13 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main() | ^~~~
ソースコード
#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.rend()->second<<endl; }