fork download
  1. // There is nothing in a caterpillar that tells you its going to be a butterfly --------------------- !
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. #define rep(i,n) for(int i=0;i<n;i++)
  5. #define ll long long int
  6. #define pi pair<int,int>
  7. #define pii pair<ll,pi>
  8. #define f first
  9. #define mp make_pair
  10. #define mod 1000000007
  11. #define s second
  12. #define pb push_back
  13.  
  14. int main(){
  15. int t;
  16. cin >> t;
  17. while(t--){
  18. ll F,H,W,x;
  19. cin >> F >> H >> W;
  20. vector<ll>cuts;
  21. rep(i,F){
  22. cin >> x;
  23. cuts.pb(x);
  24. }
  25. cuts.pb(0);
  26. cuts.pb(W);
  27. sort(cuts.begin(),cuts.end());
  28. ll ans=INT_MAX;
  29. for(int i=1;i<cuts.size();i++){
  30. ans=min(ans,cuts[i]-cuts[i-1]);
  31. }
  32. ans*=H;
  33. cout<<ans<<"\n";
  34. }
  35. }
  36.  
Success #stdin #stdout 0s 3464KB
stdin
3
1 1 2
1
1 4 5
3
2 3 9
6 2
stdout
1
8
6