結果
| 問題 | No.3627 Share the Median |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-14 23:10:15 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,386 bytes |
| 記録 | |
| コンパイル時間 | 2,014 ms |
| コンパイル使用メモリ | 345,836 KB |
| 実行使用メモリ | 9,544 KB |
| 平均クエリ数 | 519.90 |
| 最終ジャッジ日時 | 2026-08-14 23:10:22 |
| 合計ジャッジ時間 | 5,983 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| Sample | 0 % | |
| Easy | 20 % | WA * 16 |
| Hard | 80 % | AC * 4 WA * 20 |
| 合計 | 3 * 0% = 0 点 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void Alice(bool is_Bob){
int Q, n, m;
cin >> Q >> n >> m;
if(is_Bob) swap(n, m);
vector<pair<int,int>> a(n);
for(int i = 0; i < n; i++){
cin >> a[i].first;
a[i].second = i;
}
sort(a.begin(), a.end());
int mx = max(n, m), k = (n + m + 1) / 2, v, cur = 0;
int ops = 0;
for(int i = 0; i < mx; i++){
int pos = min(n, k / 2);
cout << "share " << a[pos - 1].second + 1 << endl;
cin >> v;
if(a[pos].first <= v){
cur += pos;
k -= pos;
}else{
ops += min(m, k / 2);
k -= min(m, k / 2);
}
if(cur == n || ops == m) break;
}
if(cur == n || ops == m){
if(cur == n){
cout << "share " << a[n - 1].second + 1 << endl;
cin >> v;
cout << "answer " << v << endl;
}else{
cout << "share " << a[k - 1].second + 1 << endl;
cin >> v;
cout << "answer " << a[k - 1].first << endl;
}
}else{
cout << "share " << a[k - 1].second + 1 << endl;
cin >> v;
cout << "answer " << min(v, a[k - 1].first) << endl;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string player;
cin >> player;
if(player == "Alice") Alice(false);
else Alice(true);
}