- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathparser.cpp
More file actions
Latest commit
39 lines (24 loc) · 589 Bytes
/
Copy pathparser.cpp
File metadata and controls
39 lines (24 loc) · 589 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<bits/stdc++.h>
usingnamespacestd;
intmain(int argc, char* argv[])
{
ifstream F(argv[1]);
int a, b;
int nedges = 0;
string line;
while(getline(F, line)){nedges++;}
F.clear();
F.seekg(0);
set<pair<int, int>> S;
for(int i=0;i<nedges;i++){
F >> a >> b;
if (a == b) continue;
S.insert({min(a, b), max(a, b)});
}
string rawname = argv[2];
ofstream MyFile(rawname);
for(auto iter : S){
MyFile << iter.first << "" << iter.second << endl;
}
return (0);
}