結果

問題 No.3281 Pacific White-sided Dolphin vs Monster
ユーザー 00 Sakuda
提出日時 2025-09-26 22:14:20
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 1,232 ms
コンパイル使用メモリ 102,416 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-26 22:14:24
合計ジャッジ時間 4,298 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
using namespace std;
using ll = long long;
int main() {
	int N;cin >> N;
	vector<ll> H(N);
	int K = 60;
	vector<int> CNT(K+1, 0);
	int mx =0;
	for (int i = 0;i < N;i++) {
		cin >> H[i];
		int lst = 0;
		for (int j = K;j >= 0;j--) {
			if (H[i] & (1LL << j)) {
				lst = j;
				break;
			}
		}
		CNT[lst]++;
		mx = max(mx, lst);
	}
	int sm = 0;
	for (int i = 0;i <= mx;i++) sm += max(0, CNT[i]-1);
	int res = mx + 1 + sm;
	cout << res << endl;
}
0