結果

問題 No.937 Ultra Sword
ユーザー uzzyuzzy
提出日時 2019-11-29 23:23:22
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,259 bytes
コンパイル時間 2,689 ms
コンパイル使用メモリ 179,908 KB
実行使用メモリ 5,660 KB
最終ジャッジ日時 2023-08-13 09:15:12
合計ジャッジ時間 14,734 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 4 ms
5,036 KB
testcase_03 AC 4 ms
5,032 KB
testcase_04 AC 3 ms
4,940 KB
testcase_05 AC 13 ms
5,264 KB
testcase_06 AC 168 ms
5,356 KB
testcase_07 AC 177 ms
5,404 KB
testcase_08 AC 116 ms
5,308 KB
testcase_09 AC 98 ms
5,160 KB
testcase_10 AC 184 ms
5,540 KB
testcase_11 AC 709 ms
5,240 KB
testcase_12 AC 875 ms
5,324 KB
testcase_13 AC 876 ms
5,312 KB
testcase_14 AC 876 ms
5,524 KB
testcase_15 AC 870 ms
5,448 KB
testcase_16 AC 79 ms
5,144 KB
testcase_17 AC 427 ms
5,072 KB
testcase_18 AC 871 ms
5,288 KB
testcase_19 AC 866 ms
5,172 KB
testcase_20 AC 853 ms
5,380 KB
testcase_21 AC 211 ms
5,660 KB
testcase_22 AC 4 ms
4,876 KB
testcase_23 AC 4 ms
4,880 KB
testcase_24 AC 12 ms
5,320 KB
testcase_25 AC 34 ms
5,256 KB
testcase_26 AC 113 ms
5,400 KB
testcase_27 AC 51 ms
5,228 KB
testcase_28 AC 200 ms
5,252 KB
testcase_29 AC 26 ms
5,200 KB
testcase_30 AC 199 ms
5,112 KB
testcase_31 AC 55 ms
5,316 KB
testcase_32 AC 30 ms
5,092 KB
testcase_33 AC 33 ms
5,380 KB
testcase_34 AC 199 ms
4,956 KB
testcase_35 AC 26 ms
4,976 KB
testcase_36 AC 55 ms
5,256 KB
testcase_37 AC 54 ms
4,916 KB
testcase_38 AC 51 ms
5,324 KB
testcase_39 AC 26 ms
4,920 KB
testcase_40 AC 32 ms
5,356 KB
testcase_41 AC 28 ms
5,016 KB
testcase_42 AC 31 ms
5,188 KB
testcase_43 AC 52 ms
5,252 KB
testcase_44 AC 364 ms
5,036 KB
testcase_45 AC 48 ms
5,060 KB
testcase_46 AC 373 ms
5,116 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 += (ll)(i - i / j) * hist[i];
			}
			chmax(saidai, kari);
		}
	}

	co(goukei - saidai);

	Would you please return 0;
}
0