結果
| 問題 |
No.118 門松列(2)
|
| コンテスト | |
| ユーザー |
kurome____
|
| 提出日時 | 2016-02-28 21:37:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 5,000 ms |
| コード長 | 1,012 bytes |
| コンパイル時間 | 2,241 ms |
| コンパイル使用メモリ | 169,884 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 08:02:05 |
| 合計ジャッジ時間 | 2,992 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | scanf("%d ", &n);
| ~~~~~^~~~~~~~~~~
main.cpp:29:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
29 | scanf("%d ", a+i);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,s,e) for(int (i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)
#define RFOR(i,e,s) for(int (i)=(e)-1;(i)>=(int)(s);(i)--)
#define RREP(i,e) RFOR(i,0,e)
#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
typedef long long ll;
typedef pair<int, int> PII;
typedef priority_queue<int> PQI;
typedef priority_queue<PII> PQII;
const double EPS = 1e-10;
const int N = 1e5;
const ll mod = 1e9+7;
int n;
int a[N];
int main() {
scanf("%d ", &n);
vector<int> b(n);
REP(i,n) {
scanf("%d ", a+i);
b[i] = a[i];
}
sort(all(b));
b.erase(unique(all(b)), b.end());
int m = (int)b.size();
map<int, int> idx;
REP(i,m) idx[b[i]] = i;
fill(all(b), 0);
REP(i,n) b[idx[a[i]]]++;
ll res = 0;
REP(i,m) FOR(j,i+1,m) FOR(k,j+1,m) {
ll tmp = (ll)b[i];
tmp = (tmp*b[j]) % mod;
tmp = (tmp*b[k]) % mod;
res = (res + tmp) % mod;
}
printf("%lld\n", res);
return 0;
}
kurome____