Source Code
#include <iostream>
#include <cmath>
using namespace std;

int main() {
  
  int t,n,max;
  cin >> t;
  
  for(int i=0;i<t;i++){
    cin >> n;
    int wall[n];
    int children[n];
    int dif[n];
    
     for(int i=0;i<n;i++){
      cin>>wall[i];
     }
    
     for(int i=0;i<n;i++){
      cin>>children[i];
     }
    
     max=children[0]-wall[0];
    
     for(int i=0;i<n;i++){
        dif[i]=children[i]-wall[i];
    }
    
    for(int i=0;i<n;i++){
      if(max<dif[i])
        max=dif[i];
     }
      cout<<abs(max)<<endl;
 }
}
Copy
Garden Walls OmarQuishawi
GNU G++17
163 ms
488 KB
Wrong Answer