結果
| 問題 |
No.118 門松列(2)
|
| ユーザー |
m_tsubasa
|
| 提出日時 | 2020-08-06 17:33:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,343 bytes |
| コンパイル時間 | 2,247 ms |
| コンパイル使用メモリ | 194,892 KB |
| 最終ジャッジ日時 | 2025-01-12 15:23:40 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template <int mod = (int)(1e9 + 7)>
struct ModInt {
int x;
constexpr ModInt() : x(0) {}
constexpr ModInt(int64_t y)
: x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
constexpr ModInt &operator+=(const ModInt &p) noexcept {
if ((x += p.x) >= mod) x -= mod;
return *this;
}
constexpr ModInt &operator-=(const ModInt &p) noexcept {
if ((x += mod - p.x) >= mod) x -= mod;
return *this;
}
constexpr ModInt &operator*=(const ModInt &p) noexcept {
x = (int)(1LL * x * p.x % mod);
return *this;
}
constexpr ModInt &operator/=(const ModInt &p) noexcept {
*this *= p.inverse();
return *this;
}
constexpr ModInt operator-() const { return ModInt(-x); }
constexpr ModInt operator+(const ModInt &p) const noexcept {
return ModInt(*this) += p;
}
constexpr ModInt operator-(const ModInt &p) const noexcept {
return ModInt(*this) -= p;
}
constexpr ModInt operator*(const ModInt &p) const noexcept {
return ModInt(*this) *= p;
}
constexpr ModInt operator/(const ModInt &p) const noexcept {
return ModInt(*this) /= p;
}
constexpr bool operator==(const ModInt &p) const noexcept { return x == p.x; }
constexpr bool operator!=(const ModInt &p) const noexcept { return x != p.x; }
constexpr ModInt inverse() const noexcept {
int a = x, b = mod, u = 1, v = 0, t = 0;
while (b > 0) {
t = a / b;
swap(a -= t * b, b);
swap(u -= t * v, v);
}
return ModInt(u);
}
constexpr ModInt pow(int64_t n) const {
ModInt res(1), mul(x);
while (n) {
if (n & 1) res *= mul;
mul *= mul;
n >>= 1;
}
return res;
}
friend constexpr ostream &operator<<(ostream &os, const ModInt &p) noexcept {
return os << p.x;
}
friend constexpr istream &operator>>(istream &is, ModInt &a) noexcept {
int64_t t = 0;
is >> t;
a = ModInt<mod>(t);
return (is);
}
constexpr int get_mod() { return mod; }
};
int n, len = 100;
vector<int> cnt(100, 0);
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
++cnt[--x];
}
ModInt<> res = 0;
for (int i = 0; i < 100; ++i)
for (int j = i + 1; j < 100; ++j)
for (int k = j + 1; k < 100; ++k) res += cnt[i] * cnt[j] * cnt[k];
cout << res << endl;
return 0;
}
m_tsubasa