constint N = 1010; int n, t[N], ans = INF; vector<int> pls; char op[N];
template <typename T>
inline T read(){ T sum = 0, fl = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1; for (; isdigit(ch); ch = getchar()) sum = sum * 10 + ch - '0'; return sum * fl; }
template <typename T>
inlinevoidwrite(T x){ if (x < 0) { putchar('-'), write<T>(-x); return; } static T sta[35]; int top = 0; do { sta[top++] = x % 10, x /= 10; } while (x); while (top) putchar(sta[--top] + 48); }
intmain(){ IOS cin >> n; FOR(i, 1, n) { cin >> op[i] >> t[i]; pls.push_back(t[i]); // 数组 p } unique(pls.begin(), pls.end()); // 去重 for (auto i : pls) { int tmp = 0; FOR(j, 1, n) if ((op[j] == 'L' && i > t[j]) || (op[j] == 'G' && i < t[j]))++ tmp; // 满足条件就过 ans = min(ans, tmp); } write<int>(ans); return0; }
constint N = 2e5 + 10; int n, t, ans = INF; vector<int> pls, lhs, rhs; char op;
template <typename T>
inline T read(){ T sum = 0, fl = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1; for (; isdigit(ch); ch = getchar()) sum = sum * 10 + ch - '0'; return sum * fl; }
template <typename T>
inlinevoidwrite(T x){ if (x < 0) { putchar('-'), write<T>(-x); return; } static T sta[35]; int top = 0; do { sta[top++] = x % 10, x /= 10; } while (x); while (top) putchar(sta[--top] + 48); }