結果

問題 No.1943 消えたAGCT(1)
ユーザー mnm
提出日時 2022-05-22 19:06:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 820 bytes
コンパイル時間 787 ms
コンパイル使用メモリ 76,448 KB
実行使用メモリ 9,788 KB
最終ジャッジ日時 2024-09-20 12:48:18
合計ジャッジ時間 4,415 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#define rep(i,n) for(i=0; i<n; ++i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
using namespace std;
using lint = long long;

int main(void){
    int i, j, k, v, y, n, m=0, cnt=0, c=0;
    string s, t="AGCT";
    in(n);
    in(s);
    vector<bool> x(n,true);
    rep(i,n){
        rep(j,4){
            c+=s[i]==t[j];
        }
    }
    while(c){
        m=0;
        rep(i,n){
            if(x[i]){
                if(m==c-1)  {
                    x[i]=false;
                    cnt++;
                    rep(j,4){
                        c-=s[i]==t[j];
                    }
                    break;
                }
                m++;
            }
        }
    }
    out(cnt,endl);

    return 0;
}

0