結果

問題 No.937 Ultra Sword
ユーザー uzzyuzzy
提出日時 2019-11-29 23:22:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,255 bytes
コンパイル時間 2,451 ms
コンパイル使用メモリ 181,120 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 02:50:22
合計ジャッジ時間 12,774 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 4 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 WA -
testcase_06 AC 149 ms
6,940 KB
testcase_07 AC 171 ms
6,940 KB
testcase_08 AC 117 ms
6,940 KB
testcase_09 AC 88 ms
6,940 KB
testcase_10 AC 163 ms
6,944 KB
testcase_11 AC 624 ms
6,944 KB
testcase_12 AC 783 ms
6,940 KB
testcase_13 AC 788 ms
6,944 KB
testcase_14 AC 811 ms
6,940 KB
testcase_15 AC 784 ms
6,940 KB
testcase_16 AC 71 ms
6,944 KB
testcase_17 AC 389 ms
6,940 KB
testcase_18 AC 871 ms
6,944 KB
testcase_19 AC 776 ms
6,944 KB
testcase_20 AC 760 ms
6,940 KB
testcase_21 AC 191 ms
6,940 KB
testcase_22 AC 4 ms
6,940 KB
testcase_23 AC 3 ms
6,940 KB
testcase_24 WA -
testcase_25 AC 31 ms
6,940 KB
testcase_26 AC 100 ms
6,940 KB
testcase_27 AC 48 ms
6,944 KB
testcase_28 AC 188 ms
6,944 KB
testcase_29 AC 24 ms
6,940 KB
testcase_30 AC 188 ms
6,940 KB
testcase_31 AC 54 ms
6,944 KB
testcase_32 AC 29 ms
6,944 KB
testcase_33 AC 33 ms
6,940 KB
testcase_34 AC 177 ms
6,944 KB
testcase_35 AC 24 ms
6,944 KB
testcase_36 AC 50 ms
6,944 KB
testcase_37 AC 50 ms
6,944 KB
testcase_38 AC 44 ms
6,940 KB
testcase_39 AC 23 ms
6,940 KB
testcase_40 AC 29 ms
6,944 KB
testcase_41 AC 25 ms
6,940 KB
testcase_42 AC 27 ms
6,940 KB
testcase_43 AC 46 ms
6,940 KB
testcase_44 AC 327 ms
6,940 KB
testcase_45 AC 44 ms
6,940 KB
testcase_46 AC 334 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N;
	cin >> N;
	int A[100000];
	int hist[200001] = {};
	int ikeru[200001] = {};
	ll goukei = 0;
	rep(i, N) {
		cin >> A[i];
		hist[A[i]]++;
		ikeru[A[i]] = 1;
		ikeru[A[i] * 2] = 1;
		goukei += A[i];
	}

	vector<int> hist2;
	rep(i, 100001) {
		if (hist[i]) hist2.pb(i);
	}

	int s = hist2.size();

	int hist3[200001] = {};
	rep1(i, (1 << 17) - 1) {
		if (!ikeru[i]) {
			rep(j, s) if (hist[hist2[j] ^ i]) {
				ikeru[i] = 1;
				break;
			}
		}
	}

	ll saidai = 0;
	rep1(j, 200000) {
		if (ikeru[j]) {
			ll kari = 0;
			for (int i = j; i <= 200000; i += j) {
				kari += (i - i / j) * hist[i];
			}
			chmax(saidai, kari);
		}
	}

	co(goukei - saidai);

	Would you please return 0;
}
0