#include #include #include #include using namespace std; vector graph[1000]; vector grc[1000]; int xy[1000][2]; int vis[1000]; vector ret; vector hell; int n; int rr; void go(int v){ int i; if (rr == n && v == 0)throw 1; if (vis[v])return; vis[v]=1; rr++; for (i=0; i xy[j][1] && (b==-1 || xy[j][1] > xy[b][1]))b=j; if (b==-1)continue; graph[i].push_back(b); grc[i].push_back('S'); // printf("%d z %d, %c\n", i, b, 'S'); } for(int i=0; i xy[j][0] && (b==-1 || xy[j][0] > xy[b][0]))b=j; if (b==-1)continue; graph[i].push_back(b); grc[i].push_back('W'); // printf("%d z %d, %c\n", i, b, 'W'); } for(int i=0; i 0){ for(int i=0; i