結果
| 問題 |
No.742 にゃんにゃんにゃん 猫の挨拶
|
| コンテスト | |
| ユーザー |
t33f
|
| 提出日時 | 2018-10-05 21:49:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,500 ms |
| コード長 | 364 bytes |
| コンパイル時間 | 466 ms |
| コンパイル使用メモリ | 54,740 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 13:55:55 |
| 合計ジャッジ時間 | 1,147 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
#include <iostream>
using namespace std;
int main() {
int n; cin >> n;
int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
long long ans = 0;
int bit[30002] = {};
for (int i = n-1; i >= 0; i--) {
for (int x = a[i]; x > 0; x -= x&-x) ans += bit[x];
for (int x = a[i]; x <= n; x += x&-x) bit[x]++;
}
cout << ans << endl;
}
t33f