#include #include #include #include #include #include #include #include #include #include #include using namespace std; //dfs //O(V+E) void TopologicalSort(vector > &G, vector &res, int node, vector &visit){ if(visit[node] == true) return; visit[node] = true; for(auto itr = G[node].rbegin(); itr != G[node].rend(); itr++){ TopologicalSort(G, res, *itr, visit); } /* for(int i=0; i p){ os << "{" << p.first << ", " << p.second << "} "; return os; } template ostream& operator << (ostream& os, vector vec){ for(int i=0; i int main(int argc, char* argv[]){ /* ifstream ifs(argv[1]); int m; ifs >> m; vector w(m+1, 0); for(int i=0; i> w[i+1]; } auto comp = [&](string s){ stringstream ss; ss << s; string q; ss >> q; string ret; for(int i=0; i> a >> b; int c,d; sscanf(a.c_str(), "%d", &c); sscanf(b.c_str(), "%d", &d); ret += " "; ret += (w[c] < w[d]?'<':w[c] > w[d]?'>':'='); } return ret; }; cerr << w << endl; */ int n; cin >> n; vector> G(n); vector> rG(n); vector> E(n, vector(n, -1)); for(int i=0; i>> E_(n); for(int i=0; i used(n, false); vector v; for(int i=0; i> in; cin >> in; if(in == "=") continue; if(v[2*i] == -1 || v[2*i+1] == -1) continue; if(in == "<"){ G[v[2*i]].push_back(v[2*i+1]); rG[v[2*i+1]].push_back(v[2*i]); } if(in == ">"){ G[v[2*i+1]].push_back(v[2*i]); rG[v[2*i]].push_back(v[2*i+1]); } } } vector res; vector visit(n, false); int start = -1; for(int i=0; i