fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int long long
  4. #define dd double
  5. #define ld long double
  6. #define ull unsigned long long
  7. #define yes cout << "YES\n"
  8. #define no cout << "NO\n"
  9. #define el "\n"
  10. #define Arwa ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  11. #define fix(x) cout << fixed << setprecision(x)
  12. #define all(v) v.begin(),v.end()
  13. #define dpp(v,val) memset(v,val,sizeof(v))
  14. #define mod 1e9+7
  15. #define oo 1e9
  16. const int N = 1e5 + 5;
  17. int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } // log(n) __gcd(a,b)
  18. //todo اى ويل بريبير ماى بيبرز تو بى ذا بيست ان زيس وورلد
  19.  
  20. void HereWeGoAgain()
  21. {
  22. int n;
  23. cin>>n;
  24. int u,r,d,l;
  25. cin>>u>>r>>d>>l;
  26. if( (u<=1&&r==n&&l==n)||(r<=1&&d==n&&u==n)||(d<=1&&r==n&&l==n)||(l<=1&&d==n&&u==n) ||
  27. (u<1&&(r==n||l==n))||(r<1&&(d==n||u==n))||(d<1&&(r==n||l==n))||(l<1&&(d==n||u==n)) ||(u>n-2&&(l==0&&r==0)) ||
  28. (d>n-2&&(l==0&&r==0)) || (l>n-2&&(u==0&&d==0)) || (r>n-2&&(u==0&&d==0)) )
  29. no; else yes;
  30. }
  31. int32_t main()
  32. {
  33. Arwa
  34. int t=1;
  35. cin>>t;
  36. for(int i=1;i<=t;i++)
  37. {
  38. HereWeGoAgain();
  39. }
  40. return 0;
  41. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
YES