結果
| 問題 |
No.1943 消えたAGCT(1)
|
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2022-07-10 12:43:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 606 bytes |
| コンパイル時間 | 1,536 ms |
| コンパイル使用メモリ | 166,400 KB |
| 実行使用メモリ | 27,056 KB |
| 最終ジャッジ日時 | 2025-01-02 23:01:14 |
| 合計ジャッジ時間 | 4,048 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
string s;
cin >> n >> s;
set<int> st;
for( int i = 0; i < n; i++ ) {
if( s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T' ) st.insert( i );
}
int ans = 0;
int last = -1;
int del = 0;
while( st.size() ) {
int j = st.size() - 1;
auto it = st.lower_bound( j );
int a = *it - j + 1;
if( last < 0 ) {
last = *it;
del += a;
}
else if( *it > last ) {
int t = a;
a -= del;
del = t;
last = *it;
}
else {
last = *it;
del = a;
}
ans += a;
st.erase( it );
}
cout << ans << endl;
}
forest3