voidsolve(){ string a, b; cin >> a >> b; if (a == b) { puts ("="); return; } int n = a.size (), m = b.size (); for (int i = n - 1, j = m - 1; i >= 0 && j >= 0; i--, j--) { if (a[i] == b[j]) continue; else { if (mp[a[i]] > mp[b[j]]) puts (">"); elseputs ("<"); return ; } } if (a[n-1] == 'S') { if (n < m) puts (">"); elseputs ("<"); } else { if (n > m) puts (">"); elseputs ("<"); }
usingnamespace std; constint N = 262144 + 5; int a[N];
voidsolve(){ int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; if (is_sorted (a + 1, a + n + 1)) puts ("0"); else { //逐层check longlong ans = 0; for (int len = 1; len < n; len *= 2) { for (int i = 1; i <= n; i += len * 2) { int j = i + len; //cout << i << ' ' << j << endl; if (abs (a[j] - a[i]) != len) { puts ("-1"); return ; } if (a[j] < a[i]) ans ++, swap (a[j], a[i]); } //for (int i = 1; i <= n; i++) cout << a[i] << ' ';cout << endl; } cout << ans << endl; } }
intmain(){ int t; cin >> t; while (t --) solve (); }