Submission #26284640


Source Code Expand

////////////////<------------- Xorcestor_X -------------->////////////////
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <sstream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <iterator>
#include <queue>
#include <utility>
#include <stdexcept>
#include <numeric> 

using namespace std;
#define endl "\n"
#define ll long long int
#define c(x) ll x;cin>>x
#define cc(x,y) ll x,y;cin>>x>>y
#define ccc(x,y,z) ll x,y,z; cin>>x>>y>>z
#define db long double
#define fast cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
#define inf 1e16
#define mod 1000000007
#define mod2 998244353
#define eps 1e-7
#define PI 3.1415926535897932385
#define pb push_back
#define bitc  __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define len(x) (ll)(x).size()
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define foreach(it,ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define print(arr,n) cout<<" :: "<<#arr<<" :: "<<endl; rep(i,n) cout<<arr[i]<<" "; cout<<endl
#define print2(arr,n,m) cout<<" :: "<<#arr<<" :: "<<endl; rep(i,n){ rep(j,m) cout<<arr[i][j]<<" "; cout<<endl; }
#define dyn1(arr,n) ll* arr=new ll[n]; rep(i,n) arr[i]=0;
#define dyn2(arr,n,m) ll** arr=new ll*[(n)]; rep(i,n) arr[i]=new ll[m]; rep(i,n) rep(j,m) arr[i][j]=0
#define carr(arr,n) fr(i,0,n-1) cin>>arr[i]
#define carr2(arr,n,m) fr(i,0,n-1) fr(j,0,m-1) cin>>arr[i][j]
#define debug(a) cerr<<" :: "<<#a<<" == "<<a<<endl
#define debug2(a,b) cerr<<" :: "<<#a<<" == "<<a<<" :: "<<#b<<" == "<<b<<endl
#define watch(x) cerr << (#x) << " is " << (x) << endl
#define debugx(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debugx("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
#define bix(n) __builtin_popcount(n)
#define blx(n) __builtin_popcountll(n)
typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<vector<ll>> matrix;
inline bool equals(double a, double b){ return fabs(a - b) < 1e-9; }
ll gcd(ll a, ll b) { return b==0 ? a : gcd(b, a%b); }

ll reduce(ll& a,ll m) {
    a%=m;
    a+=m;
    a%=m;
    return a;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1) 
          res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}


int main() {
    fast;
    cout<<setprecision(6)<<fixed;
    
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    string s;
    string t;
    cin>>s>>t;
    if(s.length()!=t.length()){
        cout<<"No"<<endl;
        return 0;
    }

    int n=s.length();
    vector<ll> indices;
    for(int i=0;i<n;i++){
        if(s[i]!=t[i]){
            indices.push_back(i);
        }
    }

    if(indices.size()==0){
        cout<<"Yes"<<endl;
    } else if(indices.size()==2){
        if(abs(indices[0]-indices[1])==1&&s[indices[0]]==t[indices[1]]&&s[indices[1]]==t[indices[0]]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    } else {
        cout<<"No"<<endl;
    }

    return 0;
}

Submission Info

Submission Time
Task B - typo
User unmesh_kumar
Language C++ (GCC 9.2.1)
Score 200
Code Size 3769 Byte
Status AC
Exec Time 6 ms
Memory 3656 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 15
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, example0.txt, example1.txt, example2.txt
Case Name Status Exec Time Memory
000.txt AC 6 ms 3516 KiB
001.txt AC 3 ms 3624 KiB
002.txt AC 2 ms 3656 KiB
003.txt AC 2 ms 3616 KiB
004.txt AC 2 ms 3612 KiB
005.txt AC 2 ms 3580 KiB
006.txt AC 2 ms 3616 KiB
007.txt AC 2 ms 3612 KiB
008.txt AC 2 ms 3652 KiB
009.txt AC 2 ms 3548 KiB
010.txt AC 3 ms 3548 KiB
011.txt AC 2 ms 3496 KiB
example0.txt AC 2 ms 3556 KiB
example1.txt AC 2 ms 3656 KiB
example2.txt AC 2 ms 3516 KiB