結果
| 問題 | No.3627 Share the Median |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-14 23:12:04 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,441 bytes |
| 記録 | |
| コンパイル時間 | 2,007 ms |
| コンパイル使用メモリ | 345,736 KB |
| 実行使用メモリ | 9,544 KB |
| 平均クエリ数 | 7.97 |
| 最終ジャッジ日時 | 2026-08-14 23:12:10 |
| 合計ジャッジ時間 | 5,843 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| Sample | 0 % | |
| Easy | 20 % | AC * 3 WA * 13 |
| Hard | 80 % | AC * 7 WA * 17 |
| 合計 | 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 + 1 < Q; 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;
}
if(v <= a[pos].first){
ops += min(m, k / 2);
k -= min(m, k / 2);
}
if(cur == n || ops == m) break;
if(k == 1) 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);
}