- set的插入与遍历
为什么会超时 可以怎么修改呢
- 2024-4-8 15:54:28 @
#include<bits/stdc++.h> using namespace std; int main(){ int n; set<int> t; cin>>n; for(int i=0;i<n;i++){ int a; cin>>a; t.insert(a); } set<int>::iterator iter; for(iter=t.begin();iter!=t.end();iter++){ cout<<*iter<<' '; } return 0; }
1 comments
-
kazzwi不想敲代码 LV 4 @ 2024-4-10 0:18:17
可以在主函数加上 ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- 1
Information
- ID
- 69
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 8
- Tags
- # Submissions
- 861
- Accepted
- 143
- Uploaded By