이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define pb push_back
#define pf push_front
#define pi pair<int,int>
string a,b;
const int MAX = 1e5+1;
int n;
 ll pref[MAX], wrong[MAX];
void init(string A, string B){
    a = A;
    b = B;
}
int get_distance(int x, int y){
    ll add = 0;
    ll sub = 0;
     map<char,int>mp;
     string k = a.substr(x,y-x+1);
     string h= b.substr(x,y-x+1);
     sort(k.begin(),k.end());
     sort(h.begin(),h.end());
     if(h!=k){
        return -1;
     }
     for(int i = x; i<= y; i++){
       if(a[i]!=b[i]){
           add++;
           if(mp[a[i]]){
                sub++;
                mp[a[i]]--;
           }
           else mp[b[i]]++;
    
            
       }
         
    }
    //cout << add<<" "<<sub<< " "<< endl;
    return add-sub;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |