Pagini recente » Cod sursa (job #722443) | Cod sursa (job #2034796) | Cod sursa (job #1677589) | Cod sursa (job #1534438) | Cod sursa (job #1574661)
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
using namespace std;
unordered_map <string, bool> mp;
vector <int> v;
int n, m;
string x("x");
ifstream fin("sortaret.in");
ofstream fout("sortaret.out");
bool cmp(int a, int b)
{
return mp[to_string(a)+x+to_string(b)] == 1;
}
int main()
{
fin >> n >> m;
for(int i = 0; i < n; i++)
{
v.push_back(i+1);
}
int a, b;
for(int i = 0; i < m; i++)
{
fin >> a >> b;
mp[to_string(a)+x+to_string(b)] = 1;
}
sort(v.begin(), v.end(), cmp);
for(auto i : v)
{
fout << i << ' ';
}
}