結果

問題 No.203 ゴールデン・ウィーク(1)
ユーザー kohei2019kohei2019
提出日時 2021-09-23 22:31:11
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 8,644 bytes
コンパイル時間 3,625 ms
コンパイル使用メモリ 174,336 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 09:34:51
合計ジャッジ時間 4,761 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:195:9: warning: left operand of comma operator has no effect [-Wunused-value]
  195 |         a,b = b,a%b;
      |         ^
main.cpp:195:18: warning: expression result unused [-Wunused-value]
  195 |         a,b = b,a%b;
      |                 ~^~
main.cpp:310:21: warning: field 'N' is uninitialized when used here [-Wuninitialized]
  310 |     int group_cnt = N;
      |                     ^
main.cpp:311:5: note: during field initialization in this constructor
  311 |     UnionFind(int N){
      |     ^
3 warnings generated.

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll,ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define INF 100000000
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
//x:コンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf
#define MOD 1000000007 //問題による
#define F first
#define S second
//出力(空白区切りで昇順に)
#define coutALL(x) for(auto i=x.begin();i!=--x.end();i++)cout<<*i<<" ";cout<<*--x.end()<<endl
#define coutALL1D(x) for(const auto & y:x){cout << y << " ";} cout << endl;
#define coutALL2D(x) for (const auto & y:x){for (const auto & z:y){cout << z << " ";}cout << endl;}
#define coutALLn(x) for(auto i=x.begin();i!=--x.end();i++)cout<<*i<<endl;cout<<*--x.end()<<endl
ll myceil(ll a,ll b){return (a+(b-1))/b;}
ll myfloor(ll a,ll b){return a/b;}

int vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

vector<ll> vector_find_ll(vector<ll> vec,ll num){
    int N = vec.size();
    vector<ll> match_num;
    rep(i,N){
        if (vec[i] == num){
            match_num.push_back(i);
        }
    }
    return match_num;
}

ll maxvec(vector<ll> vec){
    ll ret = -INF64;
    int N = vec.size();
    rep(i,N){
        ret = max(ret,vec[i]);
    }
    return ret;
}

ll minvec(vector<ll> vec){
    ll ret = INF64;
    int N = vec.size();
    rep(i,N){
        ret = min(ret,vec[i]);
    }
    return ret;
}

ll sumvec(vector<ll> ls){
    ll v = 0;
    int N = ls.size();
    rep(i,N){
        v += ls[i];
    }
    return v;
}

vector<ll> valuesmap(map<ll,ll> mp){
    vector<ll> ret;
    for (const auto & [key,value] : mp){
        ret.push_back(value);
    }
    return ret;
}

vector<ll> keysmap(map<ll,ll> mp){
    vector<ll> ret;
    for (const auto & [key,value] : mp){
        ret.push_back(key);
    }
    return ret;
}

vector<ll> set_to_vec(set<ll> st){
    vector<ll> ret;
    for (const auto & s:st){
        ret.push_back(s);
    }
    return ret;
}

vector<string> set_to_vec(set<string> st){
    vector<string> ret;
    for (const auto & s:st){
        ret.push_back(s);
    }
    return ret;
}

set<string> vec_to_set(vector<string> vec){
    set<string> ret;
    for (const auto & s:vec){
        ret.insert(s);
    }
    return ret;
}

map<ll,ll> Counter(vector<ll> vec){
    map<ll,ll> ret;
    for (const auto & s:vec){
        ret[s] += 1;
    }
    return ret;
}

map<string,ll> Counter(vector<string> vec){
    map<string,ll> ret;
    for (const auto & s:vec){
        ret[s] += 1;
    }
    return ret;
}

ll bisect_left(vector<ll> &vec,ll arg){
    //sort済みvecを二分探索
    ll ok=0;
    ll ng=vec.size();
    ll mid;
    while (abs(ng-ok) > 1){
        mid = (ok+ng)/2;
        if (vec[mid] > arg){
            ng = mid;
        }
        else{
            ok = mid;
        }
    }
    return ok;
}

ll bisect_right(vector<ll> &vec,ll arg){
    //sort済みvecを二分探索
    ll ng=0;
    ll ok=vec.size();
    ll mid;
    while (abs(ok-ng) > 1){
        mid = (ok+ng)/2;
        if (vec[mid] > arg){
            ok = mid;
        }
        else{
            ng = mid;
        }
    }
    return ok;
}

set<ll> primeset(ll N){
    // N以下の素数を全部列挙
    vector<ll> lsx(N+1,1);
    FOR(i,2,ceil(pow(N,0.5)+1)){
        if (lsx[i] == 1){
            for(ll j=i;j<N/i+1;j++){
                lsx[j*i] = 0;
            }
        }
    }
    set<ll> ret;
    for (ll i=2;i < N+1; i++){
        if (lsx[i] == 1){
            ret.insert(i);
        }
    }
    return ret;
}

ll gcd(ll a,ll b){
    while (b != 0){
        a,b = b,a%b;
    }
    return a;
}

ll lmc(ll a, ll b){
    ll c = gcd(a,b);
    return a*b/c;
}

ll gcdvec(vector<ll> vec){
    ll ret=vec[0];
    for (const auto & v:vec){
        ret = gcd(ret,v);
    }
    return ret;
}

ll lmcvec(vector<ll> vec){
    ll ret=vec[0];
    for (const auto & v:vec){
        ret = lmc(ret,v);
    }
    return ret;
}

vector<vector<ll>> factorization(ll N){
    vector<vector<ll>> ret;
    ll temp = N;
    FOR(i,2,ceil(pow(N,0.5)+1)){
        if (temp%i==0){
            ll cnt = 0;
            while(temp%i==0){
                cnt += 1;
                temp /= i;
            }
            ret.push_back({i,cnt}); 
        }
    }
    if (temp!=1){
        ret.push_back({temp,1});
    }
    if (ll(ret.size())==0){
        ret.push_back({N,1});
    }
    return ret;
}

set<ll> factorizationset(ll N){
    set<ll> ret;
    if (N==1){
        return ret;
    }
    ll temp = N;
    FOR(i,2,ceil(pow(N,0.5)+1)){
        if (temp%i==0){
            ll cnt = 0;
            while(temp%i==0){
                cnt += 1;
                temp /= i;
            }
            ret.insert(i); 
        }
    }
    if (temp!=1){
        ret.insert(temp);
    }
    return ret;
}

ll  divisorsnum(ll N){//約数の個数
    if (N==1){
        return 1;
    }
    vector<vector<ll>> p = factorization(N);
    ll ret = 1;
    for (const auto & v:p){
        ret *= v[1]+1;
    }
    return ret;
}

vector<ll> make_divisors(ll N){
    vector<ll> lower_divisors , upper_divisors;
    ll i = 1;
    while (i*i <= N){
        if (N%i==0){
            lower_divisors.push_back(i);
            if (i != (N/i)){
                upper_divisors.push_back(N/i);
            }
        }
        i++;
    }
    for (ll i=ll(upper_divisors.size())-1 ; i >= 0; i--){
        lower_divisors.push_back(upper_divisors[i]);
    }
    return lower_divisors;
}

ll invmod(ll a,ll mod){
    if (a==0){
        return 0;
    }
    if (a==1){
        return 1;
    }
    return (mod*mod - invmod(mod % a,mod)*(mod/a))%mod;
}


struct UnionFind{
    int N;
    vector<int> parents;
    vector<int> sizeg;
    int group_cnt = N;
    UnionFind(int N){
        rep(i,N) parents.push_back(i);
        rep(i,N) sizeg.push_back(1);
    } 
    int find(int x){
        if (x == parents[x]){
            return x;
        }
        else{
            parents[x] = find(parents[x]);
            return parents[x];
        }
    }
    void unite(int x,int y){
        x = find(x);
        y = find(y);
        if (x > y){
            swap(x,y);
        }
        if (x == y){
            return;
        }
        sizeg[x] += sizeg[y];
        parents[y] = x;
        group_cnt -= 1;
    }
    int size(int x){
        return sizeg[find(x)];
    }
    bool same(int x,int y){
        return find(x) == find(y);
    }
    int groupcount(){
        return group_cnt;
    }
};

struct SegTree{
    ll DEFAULT = 0;
    ll func(ll x, ll y){
        return x ^ y;
    }
    int N,K = 0,N2;
    vector<ll> dat;
    SegTree(vector<ll> ls){
        N = ls.size();
        while ((N-1) >> K){
            K += 1;
        }
        //K -= 1;
        N2 = 1 << K;
        rep(i,1<<(K+1)){
           dat.push_back(DEFAULT); 
        }
        rep(i,N){
            dat[N2+i] = ls[i];
        }
        for (int i=N2-1;i>0;i--){
            dat[i] = func(dat[i<<1],dat[i<<1|1]);
        }
    }
    ll leafval(int x){
        return dat[x+N2];
    }
    void update(int x,ll y){
        int i = x + N2;
        dat[i] = y;
        while (i > 0){
            i >>= 1;
            dat[i] = func(dat[i<<1],dat[i<<1|1]);
        }
    }
    ll query(int L,int R){
        L += N2;
        R += N2;
        ll vL = DEFAULT;
        ll vR = DEFAULT;
        while (L < R){
            if (L & 1){
                vL = func(vL,dat[L]);
                L += 1;
            }
            if (R & 1){
                R -= 1;
                vR = func(dat[R],vR);
            }
            L >>= 1;
            R >>= 1;
        }
        return func(vL,vR);
    }
};



int main(){
    string S;
    rep(i,14){
        char c;
        cin >> c;
        S += c;
    }
    ll ans = 0;
    ll cnt = 0;
    for (const auto & a:S){
        if (a=='o'){
            cnt += 1;
            ans = max(ans,cnt);
        }
        else{
            cnt = 0;
        }
    }
    cout << ans << endl;
}
0