結果
| 問題 |
No.3130 Twin's Add Max Min Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-25 22:43:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,438 bytes |
| コンパイル時間 | 2,584 ms |
| コンパイル使用メモリ | 207,092 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-25 22:44:14 |
| 合計ジャッジ時間 | 7,150 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
long long jury(int N,vector<int> A,int Add,int Max,int Min){
int dep = 0;
auto dfs = [&](auto dfs,vector<int> now,int ad,int ma,int mi,long long x) -> long long {
dep++;
int n = now.size();
if(n == 0){
dep--;
return x;
}
long long ret = 0;
for(int i=0; i<n; i++){
long long val = 1e18;
long long y = now.at(i);
now.erase(now.begin()+i);
if(ad) val = min(val,dfs(dfs,now,ad-1,ma,mi,x+y));
if(dep == 1){
cout << "stop" << endl;
}
if(ma) val = min(val,dfs(dfs,now,ad,ma-1,mi,max(x,y)));
if(dep == 1){
cout << "stop" << endl;
}
if(mi) val = min(val,dfs(dfs,now,ad,ma,mi-1,min(x,y)));
if(dep == 1){
cout << "stop" << endl;
}
now.insert(now.begin()+i,y);
ret = max(ret,val);
}
dep--;
return ret;
};
return dfs(dfs,A,Add,Max,Min,0);
}
random_device rnd;
mt19937 mt(rnd());
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
bool test = false;
while(true){
vector<int> Akane(N);
int Add = 0,Max = 0,Min = 0;
if(test == false) for(auto &a : Akane) cin >> a;
if(test) for(auto &a : Akane) a = mt()%9+1;
for(int i=0; i<N; i++){
string s;
int k = mt()%3;
if(k == 0) s = "add";
if(k == 1) s = "max";
if(k == 2) s = "min";
if(test == false) cin >> s;
if(s == "add") Add++;
else if(s == "max") Max++;
else Min++;
}
sort(Akane.rbegin(),Akane.rend());
if(Min == N){
continue;
cout << 0 << endl; //かわいそう.
return 0;
}
long long answer = Akane.at(Min);
for(int i=Min+Max+1; i<N; i++) answer += Akane.at(i);
//long long ju = jury(N,Akane,Add,Max,Min);
//if(answer != ju && test){
// cout << "Wrong" << endl;
// cout << N << endl;
// for(auto a : Akane) cout << a << " "; cout << endl;
// cout << Add << " " << Max << " " << Min << endl;
// cout << answer << " " << ju << endl;
// return 0;
//}
if(Min) answer = min(answer,1LL*Akane.at(0)); //え.
cout << answer << endl; break;
}
}