結果
| 問題 |
No.919 You Are A Project Manager
|
| ユーザー |
|
| 提出日時 | 2019-10-25 08:25:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,256 bytes |
| コンパイル時間 | 1,795 ms |
| コンパイル使用メモリ | 175,956 KB |
| 実行使用メモリ | 817,408 KB |
| 最終ジャッジ日時 | 2024-07-19 03:51:24 |
| 合計ジャッジ時間 | 4,874 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | WA * 1 MLE * 1 -- * 53 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template <class T> inline void chmax(T& a, const T b){a=max(a,b);}
int main() {
int N; cin >> N;
vector<int> A(N);
for(int i = 0; i < N; ++i) cin >> A[i];
random_device rnd; // 非決定的な乱数生成器を生成
mt19937 mt(rnd()); // メルセンヌ・ツイスタの32ビット版、引数は初期シード値
uniform_int_distribution<> randK(1, N); // [0, 99] 範囲の一様乱数
uniform_int_distribution<> randL(1, N/2); // [0, 99] 範囲の一様乱数
uniform_int_distribution<> randR(1, N/2); // [0, 99] 範囲の一様乱数
long long ans = 0;
for(int n = 0; n <= 5000; ++n){
int K = randK(mt);
int L = randL(mt);
int R = randR(mt);
long long sum = 0;
for(int i = 1; i <= L; ++i) {
vector<long long> B;
for(int j = K*(i-1); j < K*i && K*i <= N; ++j) {
B.push_back(A[j]);
}
sort(B.begin(),B.end());
if(B.size()) sum += B[K/2];
}
for(int i = 1; i <= R; ++i) {
vector<long long> B;
for(int j = N-1 - K*(i-1); N-1 - K*i < j && K*L <= N-1 - K*i; --j) {
B.push_back(A[j]);
}
sort(B.begin(),B.end());
if(B.size()) sum += B[K/2];
}
chmax(ans,sum);
}
cout << ans << endl;
return 0;
}