Submission #4699588


Source Code Expand

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

template<typename T>
void chmax(T &a, T b) {
    a = max(a, b);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = 0;
    REP (i, 0, s.size()) {
        REP (j, i, s.size()) {
            bool ok = true;
            REP (k, i, j + 1) {
                if (s[k] != 'A' && s[k] != 'C' && s[k] != 'G' && s[k] != 'T') {
                    ok = false;
                }
            }
            if (ok) {
                chmax(ans, j - i + 1);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task B - ATCoder
User commy
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1148 Byte
Status
Exec Time 2 ms
Memory 384 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 a01, a02, a03
All 200 / 200 a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 1 ms 256 KB
a02 1 ms 256 KB
a03 1 ms 256 KB
b04 1 ms 256 KB
b05 2 ms 384 KB
b06 1 ms 256 KB
b07 1 ms 256 KB
b08 1 ms 256 KB
b09 1 ms 256 KB
b10 1 ms 256 KB
b11 1 ms 256 KB
b12 1 ms 256 KB
b13 1 ms 256 KB