#include #include #include #include using namespace std; /* * Author * Robin Lee (hex539) * * Algorithm * Lyndon factorisation identifies the minimum rotation of each clock's * difference string and then checks if the two are identical. */ template int factorise(basic_string s){ s+=s; int k=0; for (int i=1,j=0; is[j]){ j=k; }else if (s[i] read_clock(int n){ int const modulo = 360000; vector v(n); for (int i=0; i>v[i]; sort(v.begin(),v.end()); v.push_back(v.front()+modulo); basic_string s; for (int i=0; i>n; basic_string a=read_clock(n), b=read_clock(n); cout<<(a==b? "possible": "impossible")<