# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
115069 | 2019-06-05T05:44:28 Z | 윤교준(#2865) | Lock Puzzle (innopolis2018_final_A) | C++14 | 2 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; char A[2055], B[2055]; int C[26]; int N, M; void f(int n) { printf("%d ", n); rotate(A+1, A+N-n+1, A+N+1); reverse(A+1, A+n+1); } int main() { scanf("%d%*d %s %s", &N, A+1, B+1); for(int i = 1; i <= N; i++) { C[A[i]-'a']++; C[B[i]-'a']--; } for(int i = 0; i < 26; i++) if(C[i]) { puts("-1"); return 0; } printf("%d\n", N*2); M = N/2; for(int i = 1; i <= M; i++) { char c = B[M-i+1], e = B[M+i]; int ci, ei; for(ci = i*2-1;; ci++) if(c == A[ci]) break; for(ei = i*2-1;; ei++) if(e == A[ei] && ci != ei) break; if(ci < ei) { int A = (i-1)<<1, B = ci-A-1, D = ei-ci-1, F = N-ei; f(F+1); f(B+D+1); f(A+B+F+1); f(1); } else { int A = (i-1)<<1, B = ei-A-1, D = ci-ei-1, F = N-ci; f(D+F+2); f(B); f(A+D+1); f(1); } } puts(""); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |