func_code_string: #include<bits/stdc++.h>   using namespace std;   #define ll long long   #define ull unsigned long long   #define inf INT_MAX   #define minf INT_MIN   #define infl LLONG_MAX   #define minfl LLONG_MIN   #define mod 1000000007         /*----------------------Debugger-----------------------------------*/      #ifndef ONLINE_JUDGE   #define show(x) cerr<< #x << :  ; _print(x); cerr <<endl;   #else   #define show(x)   #endif      template<class T> void _print(T x){ cerr<<x<<endl; }   template<class T> void _print(vector<T> x){cerr<< [ ; for(auto i: x) cerr<<i<< ,  ; cerr<< ] n ;}   template<class T> void _print(set<T> x){ cerr<< {  ; for(auto i: x) cerr<<i<< ,  ; cerr<< } n ;}         /*-------------------------------------------------------------------------------------------------*/      ll exp(int a,int b,int p){ll res=1; a=a%p;     while(b){ if(b & 1) res=(res*a)%p; a=((ll)a*a)%p; b=b>>1; } return res; }      ll mmiPrime(int a, int p){ return exp(a,p-2,p); }      pair<int,int> extendedGCD(int a, int b){ if(b==0){ pair<int,int> ans; ans.first=1; ans.second=0; return ans; }    pair<int,int> temp=extendedGCD(b,a%b); pair<int,int> ans;    ans.first=temp.second; ans.second=temp.first - (a/b)*temp.second; return ans; }      int mmi(int a, int m){ pair<int,int> tmp=extendedGCD(a,m); return tmp.first; }      int ncr(int n,int r, int p, int fact[]){ return ((fact[n] * mmiPrime(fact[r],p) % p) * mmiPrime(fact[n-r],p))%p; }      /*-------------------------------------------------------------------------------------------------*/         void solve(){    int n,k;    cin>>n>>k;    int a[k];    int t[k];       for(int i=0;i<k;i++)     cin>>a[i];          for(int i=0;i<k;i++)     cin>>t[i];       vector<ll> ac(n+1,INT_MAX);       for(int i=0;i<k;i++){     ac[a[i]]=t[i];    }          ll L[n+1],R[n+1];       ll p=INT_MAX;    for(int i=1;i<=n;i++){     p=min(p+1,ac[i]);     L[i]=p;    }       p=INT_MAX;    for(int i=n;i>0;i--){     p=min(p+1,ac[i]);     R[i]=p;    }       for(int i=1;i<=n;i++)     cout<<min(L[i],R[i])<<   ;    cout<<  n ;      }      int main(){    ios_base::sync_with_stdio(false); cin.tie(NULL);       #ifndef ONLINE_JUDGE     freopen( input.txt , r ,stdin);     freopen( output.txt , w ,stdout);     freopen( error.txt , w ,stderr);    #endif       clock_t time = clock();       int t;    cin>>t;    while(t--){     solve();    }       time = clock() - time;        #ifndef ONLINE_JUDGE     cout<< time:  <<time*1000/CLOCKS_PER_SEC<<  miliseconds n ;    #endif       return 0;   }