昨晚第二题卡了我好久,后来请教大佬,说是用map记录,set辅助,很容易就出来了。。。(然鹅我是第一次听说map和set啊!) 然后某度了一下相关的算法,补齐了昨晚没写完的代码,发出来给大佬们检查一下,看看有没有其他的可以更优化的地方😶 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; std::map<int,int> N;//<数, 出现次数> for (i...