Language: C++


#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll h, w, n;
  cin >> h >> w >> n;
  ll flag1 = 0;
  ll flag2 = 0;
  vector<pair<ll, ll> > v1;
  vector<pair<ll, ll> > v2;
  vector<pair<pair<ll, ll> , ll> > v3;
  vector<pair<pair<ll, ll> , ll> > v4;
  rep(i, 0, n) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    v1.pb(mp(a, b));
    v2.pb(mp(c, d));
    if (a == 0 && c == h) {
      flag1 = 1;
      v3.pb(mp(mp(b, d), 0));
    }
    if (a == h && c == 0) {
      flag1 = 1;
      v3.pb(mp(mp(d, b), 0));
    }
    if (a == 0 && c == 0) {
      v3.pb(mp(mp(min(b, d), max(b, d)), 1));
    }
    if (a == h && c == h) {
      v3.pb(mp(mp(min(b, d), max(b, d)), 2));
    }
    if (b == 0 && d == w) {
      flag2 = 1;
      v4.pb(mp(mp(a, c), 0));
    }
    if (b == w && d == 0) {
      flag2 = 1;
      v4.pb(mp(mp(c, a), 0));
    }
    if (b == 0 && d == 0) {
      v3.pb(mp(mp(min(a, c), max(a, c)), 1));
    }
    if (b == w && d == w) {
      v3.pb(mp(mp(min(a, c), max(a, c)), 2));
    }
  }
  if (flag1 == 1 && flag2 == 1) {
    cout << "NO" << endl;
    return 0;
  }
  sort(all(v3));
  sort(all(v4));
  ll x1, x2, x3, x4, y1, y2, y3, y4;
  x1 = -1;
  x2 = -1;
  x3 = -1;
  x4 = -1;
  y1 = -1;
  y2 = -1;
  y3 = -1;
  y4 = -1;
  ll mx1 = v3[]
  if (v3.sz > 1) {
    rep(i, 0, v3.sz - 1) {
      if (v3[i].se == 0 && v3[i].se > v3[i + 1].se) {
        cout << "NO" << endl;
        return 0;
      }
      if (v3[i].se == 1) {
        if (x1 == -1) {
          x1 = v3[i].fi.fi;
          x2 = v3[i].fi.se;
        }
        else {
          if (v3[i].fi.fi < x2) {
            cout << "NO" << endl;
            return 0;
          }
        }
      }
      if (v3[i].se == 2) {
        if (x3 == -1) {
          x3 = v3[i].fi.fi;
          x4 = v3[i].fi.se;
        }
        else {
          if (v3[i].fi.fi < x4) {
            cout << "NO" << endl;
            return 0;
          }
        }
      }
    }
  }
  if (v4.sz > 1) {
    rep(i, 0, v4.sz - 1) {
      if (v4[i].se == 0 && v4[i].se > v4[i + 1].se) {
        cout << "NO" << endl;
        return 0;
      }
      if (v4[i].se == 1) {
        if (y1 == -1) {
          y1 = v4[i].fi.fi;
          y2 = v4[i].fi.se;
        }
        else {
          if (v4[i].fi.fi < y2) {
            cout << "NO" << endl;
            return 0;
          }
        }
      }
      if (v4[i].se == 2) {
        if (y3 == -1) {
          y3 = v4[i].fi.fi;
          y4 = v4[i].fi.se;
        }
        else {
          if (v4[i].fi.fi < y4) {
            cout << "NO" << endl;
            return 0;
          }
        }
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:98:15: error: expected primary-expression before ']' token
   98 |   ll mx1 = v3[]
      |               ^