eoj太猛了,就一顿暴搜。
#include <bits/stdc++.h> using namespace std; vector<int> eq, gre, le, egre, ele; int ma = 1, pos = 1; void solve(int x){ for (auto j : gre) if (x > j) pos++; for (auto j : le) if (x < j) pos++; for (auto j : egre) if (x >= j) pos++; for (auto j : ele) if (x <= j) pos++; ma = max(pos, ma); pos = 1; } int main(){ int n; cin >> n; while (n--){ string s; int c; cin >> s >> s >> c; if (s == "=") eq.push_back(c); else if (s == ">") gre.push_back(c); else if (s == "<") le.push_back(c); else if (s == "<=") ele.push_back(c); else egre.push_back(c); } for (auto i : eq) solve(i); for (auto i : gre) solve(i); for (auto i : le) solve(i); for (auto i : egre){ pos = 0; solve(i); } for (auto i : ele){ pos = 0; solve(i); } cout << ma; }
动态语言真是太棒啦(。・∀・)ノ゙
expr = list(input().replace(' =', '==') for _ in range(int(input()))) xs = set(int(e.split()[-1]) for e in expr) xs |= set(x + 1 for x in xs) | set(x - 1 for x in xs) print(max(sum(eval(e, {'X': x}) for e in expr) for x in xs))
动态语言真是太慢啦ಥ_ಥ
eoj太猛了,就一顿暴搜。
动态语言真是太棒啦(。・∀・)ノ゙
动态语言真是太慢啦ಥ_ಥ