結果

問題 No.2322 MMA文字列
ユーザー Amit YadavAmit Yadav
提出日時 2023-05-28 15:01:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 5,788 bytes
コンパイル時間 2,241 ms
コンパイル使用メモリ 216,408 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-08 06:47:12
合計ジャッジ時間 3,280 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 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 WA -
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 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
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define ll long long  
#define all(v) v.begin(), v.end()
#define pb push_back
#define sz(v) v.size()
#define vi vector<int>
#define vvi vector<vector<int>>
#define mpi  map<int,int>

const int INF=(1>>30);

int N=1e6;

bool isPrime(int num){
    bool flag=true;
    for(int i = 2; i * i <= num; i++) {
       if(num % i == 0){
            flag = false;
            break;
       }
    }
    return flag;
}

bool isVowel(char ch){
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') return true;
    return false;
}

// MODULAS 

const int mod=1e9+7;

long long modular(long long x){
    return ((x%mod + mod)%mod);
}

long long add(long long a, long long b){
    return modular(modular(a)+modular(b));
}
        
long long mul(long long a, long long b){
    return modular(modular(a)*modular(b));
}

ll modPow(ll a, ll b){
    if(b==0) return 1LL;
    if(b==1) return a%mod;
    ll res=1;
    while(b){
        if(b%2==1) res=mul(res,a);
        a=mul(a,a);
        b=b/2;
    }
    return res;
}

ll modpow(ll b, ll p, ll m){
    ll r = 1;
    while(p){
        if(p & 1) r = r*b%m;
        b = b*b%m;
        p /= 2;
    }
    return r;
}

bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){
    return (a.second < b.second);
}

ll getProduct(ll n){
    if(n == 0){
        return 1 ;
    }
    return (n%10) * getProduct(n/10) ;
}

ll digitSum(ll n){
    ll total=0;
    while(n){
        total+=n%10;
        n=n/10;
    }
    return total;
}

ll LargestDigit(ll n){
    ll largest = -1;
    while(n){
        ll r = n % 10;
        largest = max(r, largest);
        n /=10;
    }
    return largest;
}

ll ceil(ll n){
    if(n % 2 == 0){
        return n / 2;
    }
    return n / 2 + 1;
}

void SieveOfEratosthenes(int n){
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
  
    for (int p=2; p*p<=n; p++){
        if(prime[p] == true){ 
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}

bool isPalindrome(ll n)
{
    string s= to_string(n);
 
    string t= s;
    reverse(all(t));
    return s==t;
 
}

string intobinary(int n) {
    return bitset<8>(n).to_string();
}

bool isPowerOfTwo (ll x){
    return x && (!(x&(x-1)));
}

ll factorial(ll n){
  return (n==1 || n==0) ? 1:( n *((ll) factorial(n - 1)));
}

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

ll lcm(ll a,ll b){
    return (a*b)/gcd(a,b);
}

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122) return char(x-32);
    if( 65 <= int(x) && int(x) <= 90) return x;
    return -1;
}

char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122) return x;
    if( 65 <= int(x) && int(x) <= 90) return char(x+32);
    return -1;
}

int numerize (char x){
    if(48 <= int(x) && int(x) <= 57) return int(x-'0');
    if(97 <= int(x) && int(x) <= 122) return int(x-96);
    if(65 <= int(x) && int(x) <= 90) return int(x-64);
    return -1;
}

int chartoint(char x){
    return int(x-'0');
}

string inttostring(ll x){
    return to_string(x);
}

bool isarraySorted(ll arr[], ll n) {
    if (n == 0 || n == 1)
        return true;
 
    for (ll i = 1; i < n; i++) {
        if (arr[i - 1] > arr[i]) {
            return false;
        }
    }
    return true;
}

bool isvectorSorted(vector<int> arr) {
    int n=arr.size();
    if (n == 0 || n == 1)
        return true;
 
    for (ll i = 1; i < n; i++) {
        if (arr[i - 1] > arr[i]) {
            return false;
        }
    }
    return true;
}

bool isPerfectSquare(ll x){  
    if (x >= 0) {
        ll sr = sqrt(x);
       
        return (sr * sr == x);
    }
    return false;
}

ll reverse(ll n) {
    ll r, rev = 0;
 
    while (n > 0) {
        r = n % 10;
        rev = rev * 10 + r;
        n = n / 10;
    }
    return rev;
}

bool isPal(string S){
    for (int i = 0; i < S.length() / 2; i++) {
        if (S[i] != S[S.length() - i - 1]) {
            return false;
        }
    }
    return true;
}

ll lastdigit(ll n){
    ll rem=n%10;
    return rem;
}

ll countDigit(ll n) {
    string num = to_string(n);
    return num.size();
}

ll arraySum(ll a[], ll n) {
   ll initial_sum  = 0; 
    return accumulate(a, a+n, initial_sum);
}

ll vectorSum(vector<int> a, ll n) {
    ll initial_sum  = 0; 
    return accumulate(a.begin(), a.end(), initial_sum);
}

ll binaryToDecimal(string n){
    string s= n;
    ll dec_value = 0;
 
    ll base = 1;
 
    ll len = sz(s);
    for (int i = len - 1; i >= 0; i--) {
        if (s[i] == '1')
            dec_value += base;
        base = base * 2;
    }
 
    return dec_value;
}

ll nextPerfectSquare(ll n){   
    if (ceil((double)sqrt(n)) == floor((double)sqrt(n))){
        return n*n;
    }
    ll nextN = floor(sqrt(n)) + 1;
 
    return nextN * nextN;
}

ll firstDigit(ll n){
    while (n >= 10) 
        n /= 10;
      
    return n;
}

vector<ll> SieveOfEratosthenes(ll n,vector<ll>&mem){
    vector<bool> prime(n + 1, 1);
    for (ll p = 2; p * p <= n; p++){
        if (prime[p]){
            for (ll i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }
    prime[1] = 0;
    prime[0] = 0;
    for(int i=2; i<=n; i++){
        if(prime[i]) mem.pb(i);
    }
    return mem;
}

void dfs(int node,vector<int> adj[],vector<int>& vis){
   vis[node]=1;
   for(auto it:adj[node]){
      if(!vis[it]){
         dfs(it,adj,vis);
      }
   }
}

void solve(){
    string s; cin>>s;
    set<char> st;
    for(auto it:s) st.insert(it);

    if(st.size()==2){
        cout<<"Yes"<<endl;
        return;
    }
    cout<<"No"<<endl;
    

    return;
}

signed main()
{
    int tc; tc=1;
    // cin>>tc;
    while(tc--){
        solve();
    }
}
0