2 条题解
-
0
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; unordered_set<string> vis; vector<string> ans; for (int i = 0; i < n; i++) { string name; cin >> name; if (!vis.count(name)) { vis.insert(name); ans.push_back(name); } } cout << ans.size() << '\n'; for (auto &name : ans) cout << name << '\n'; return 0; } -
0
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; set<string> vis; vector<string> ans; for (int i = 0; i < n;i ++) { string name; cin >> name; if (!vis.count(name)) { vis.insert(name);ans.push_back(name); } } cout << ans.size() << '\n'; for (auto name : ans) cout << name << '\n'; return 0; }
- 1
信息
- ID
- 214
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- (无)
- 递交数
- 16
- 已通过
- 10
- 上传者