結果
| 問題 |
No.1904 Never giving up!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-04-15 21:30:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,041 bytes |
| コンパイル時間 | 1,509 ms |
| コンパイル使用メモリ | 173,668 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 00:01:11 |
| 合計ジャッジ時間 | 2,191 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
20 | for(auto [a,b] : cnt) {
| ^
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define all(x) begin(x),end(x)
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; }
#define debug(a) cerr << "(" << #a << ": " << a << ")\n";
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pi;
const int mxN = 1e5+1, oo = 1e9;
int main() {
int n; cin >> n;
map<int,int> cnt;
ll num=1,denum=1;
for(int i=0;i<n;++i) {
int a; cin >> a;
cnt[a]++;
}
for(auto [a,b] : cnt) {
// chance that you pick all these in some order
for(int i=b;i>=1;--i) denum*=i;
for(int i=0;i<b;++i) num*=n,n--;
}
cout << num/denum << '\n';
}