結果
| 問題 | No.3745 Line Seats |
| ユーザー |
👑 |
| 提出日時 | 2026-10-05 23:39:31 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 4 ms / 2,000 ms |
| + 430µs | |
| コード長 | 663 bytes |
| 記録 | |
| コンパイル時間 | 2,586 ms |
| コンパイル使用メモリ | 333,516 KB |
| 実行使用メモリ | 9,908 KB |
| 最終ジャッジ日時 | 2026-10-05 23:39:50 |
| 合計ジャッジ時間 | 5,530 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| 部分点 | 20 % | AC * 47 |
| 満点 | 80 % | AC * 60 |
| 合計 | 2 * 100% = 200 点 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
cin.tie(0)->sync_with_stdio(0);
ll n;cin>>n;
string s;cin>>s;
vector<ll>p;
for(int i=0;i<n;i++)
{
if(s[i]=='#')
{
p.push_back(i);
}
}
ll ans=-1,mx=0;
for(int i=0;i<n;i++)
{
if(s[i]=='#')continue;
ll idx=lower_bound(p.begin(),p.end(),i)-p.begin();
ll d1=1LL<<60,d2=1LL<<60;
if(idx<p.size())d1=p[idx]-i;
if(idx>0)d2=i-p[idx-1];
if(mx<min(d1,d2))
{
mx=min(d1,d2);
ans=i+1;
}
}
assert(ans!=-1);
cout<<ans<<endl;
}