mirror of
https://gitcode.com/Zengtudor/alg2025.git
synced 2025-12-22 07:01:46 +00:00
19 lines
376 B
C++
19 lines
376 B
C++
#include <cmath>
|
|
#include <iostream>
|
|
#include <set>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
int main(){
|
|
int n;
|
|
std::cin>>n;
|
|
std::set<int> s;
|
|
std::cout<<n<<"\n";
|
|
for(int i=1;i<=n;i++){
|
|
int tmp;
|
|
std::cin>>tmp;
|
|
if(s.find(tmp)==s.end()){
|
|
throw std::runtime_error(std::to_string(tmp));
|
|
}
|
|
s.insert(tmp);
|
|
}
|
|
} |