結果
| 問題 | No.3745 Line Seats |
| ユーザー |
ふらわぁ
|
| 提出日時 | 2026-09-23 13:40:50 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 2 ms / 2,000 ms |
| + 787µs | |
| コード長 | 3,477 bytes |
| 記録 | |
| コンパイル時間 | 2,453 ms |
| コンパイル使用メモリ | 363,496 KB |
| 実行使用メモリ | 9,916 KB |
| 最終ジャッジ日時 | 2026-09-23 13:40:55 |
| 合計ジャッジ時間 | 5,409 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| 部分点 | 20 % | AC * 47 |
| 満点 | 80 % | AC * 60 |
| 合計 | 2 * 100% = 200 点 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/unique_ptr.h:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/memory:80,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/x86_64-pc-linux-gnu/bits/stdc++.h:56,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:95:11:
/home/linuxbrew/.linuxbrew/Cellar/gcc/16.2.0/include/c++/16/bits/ostream.h:212:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:76:8: note: 'ans' was declared here
76 | ll n,ans,max=0; cin >> n;
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef _MSC_VER
#include <intrin.h>
#endif
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using P = pair<ll, ll>;
#define endl "\n"
#define rep1(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define OVERLOAD_REP(_1, _2, _3, name, ...) name
#define rep(...) OVERLOAD_REP(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define rrep(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(s) (s).begin(), (s).end()
#define fi first
#define se second
const ll mod = 998244353;
const ll inf = 4000000000000000000ll;
const ld eps = ld(0.00000000001);
static const long double pi = 3.141592653589793;
template<class T>void vcin(vector<T> &n){for(int i=0;i<int(n.size());i++) cin>>n[i];}
template<class T,class K>void vcin(vector<T> &n,vector<K> &m){for(int i=0;i<int(n.size());i++) cin>>n[i]>>m[i];}
template<class T>void vcout(vector<T> &n){for(int i=0;i<int(n.size());i++){cout<<n[i]<<" ";}cout<<endl;}
template<class T>void vcin(vector<vector<T>> &n){for(int i=0;i<int(n.size());i++){for(int j=0;j<int(n[i].size());j++){cin>>n[i][j];}}}
template<class T>void vcout(vector<vector<T>> &n){for(int i=0;i<int(n.size());i++){for(int j=0;j<int(n[i].size());j++){cout<<n[i][j]<<" ";}cout<<endl;}cout<<endl;}
void yes(bool a){cout<<(a?"yes":"no")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}
void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void possible(bool a){ cout<<(a?"possible":"impossible")<<endl; }
void Possible(bool a){ cout<<(a?"Possible":"Impossible")<<endl; }
void POSSIBLE(bool a){ cout<<(a?"POSSIBLE":"IMPOSSIBLE")<<endl; }
template<class T,class F>void print(pair<T,F> a){cout<<a.fi<<" "<<a.se<<endl;}
template<class T>auto min(const T& a){ return *min_element(all(a)); }
template<class T>auto max(const T& a){ return *max_element(all(a)); }
template<class T,class U>bool chmax(T &a,const U b) { if (a<b) { a=b; return 1; } return 0;}
template<class T,class U>bool chmin(T &a,const U b) { if (b<a) { a=b; return 1; } return 0;}
template<class T> void ifmin(T t,T u){if(t>u){cout<<-1<<endl;}else{cout<<t<<endl;}}
template<class T> void ifmax(T t,T u){if(t>u){cout<<-1<<endl;}else{cout<<t<<endl;}}
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<V<V<T>>>;
template <class T>
auto mvec(T val, ll n) { return V<T>(n, val); }
template <class T, class... Args>
auto mvec(T val, ll n, Args... args) {
return V<decltype(mvec(val, args...))>(n, mvec(val, args...));
}
vector<ll> divisor(ll x){ vector<ll> ans; for(ll i = 1; i * i <= x; i++){ if(x % i == 0) {ans.push_back(i); if(i*i!=x){ ans.push_back(x / i);}}}sort(all(ans)); return ans; }
ll pop(ll x){return __builtin_popcountll(x);}
ll poplong(ll x){ll y=-1;while(x){x/=2;y++;}return y;}
void cincout(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout<< fixed << setprecision(15);
}
//============================================================================
// main
//============================================================================
int main(){
cincout();
ll n,ans,max=0; cin >> n;
string s; cin >> s;
auto a=mvec(0LL,n);
ll cur=-n;
rep(i,n){
if(s[i]=='#') cur=i;
else a[i]=i-cur;
}
cur=2*n;
rrep(i,n){
if(s[i]=='#') cur=i;
else chmin(a[i],cur-i);
}
rep(i,n){
if(max<a[i]){
max=a[i];
ans=i+1;
}
}
cout << ans;
return 0;
}
ふらわぁ