# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
282906 | 2020-08-25T07:09:15 Z | 송준혁(#5748) | Lock Puzzle (innopolis2018_final_A) | C++17 | 0 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int,int> pii; int N; char S[2020], T[2020], B[2020]; vector<int> V; void sft(int x){ V.push_back(x); for (int i=1; i<=x; i++) B[N-x+i] = S[i]; for (int i=1; i<=N-x; i++) B[i] = S[N-i+1]; for (int i=1; i<=N; i++) S[i] = B[i]; } int main(){ scanf("%d %*d", &N); scanf("%s", S+1); scanf("%s", T+1); int s=N/2, e=s; for (int i=1; i<=N; i++){ if (T[s] == S[i]){ sft(i), sft(0); break; } } for (int i=1; i<N; i++){ int t; if (i%4 == 1 || i%4 == 0) t=s-1, s--; else t=e+1, e++; if (i&1){ for (int j=i+1; j<=N; j++) if (T[t] == S[j]){ sft(j-1), sft(N+i-j+1); break; } } else{ for (int j=1; j<=N-i; j++) if (T[t] == S[j]){ sft(j), sft(N-1); break; } } } for (int i=1; i<=N; i++) if (S[i] != T[i]){sft(0); break;} for (int i=1; i<=N; i++) if (S[i] != T[i]){puts("-1"); return 0;} printf("%d\n", (int)V.size()); for (int x : V) printf("%d ", x); printf("\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Correct | 0 ms | 384 KB | [n = 2, m = 10000], OK, 2 operations |
3 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = kpgnxupj, T = jgppnuxk |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Correct | 0 ms | 384 KB | [n = 2, m = 10000], OK, 2 operations |
3 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = kpgnxupj, T = jgppnuxk |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Correct | 0 ms | 384 KB | [n = 2, m = 10000], OK, 2 operations |
3 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = kpgnxupj, T = jgppnuxk |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Correct | 0 ms | 384 KB | [n = 2, m = 10000], OK, 2 operations |
3 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = kpgnxupj, T = jgppnuxk |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Correct | 0 ms | 384 KB | [n = 2, m = 10000], OK, 2 operations |
3 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = kpgnxupj, T = jgppnuxk |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Correct | 0 ms | 384 KB | [n = 2, m = 10000], OK, 2 operations |
3 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = kpgnxupj, T = jgppnuxk |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Correct | 0 ms | 384 KB | [n = 2, m = 10000], OK, 2 operations |
3 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = kpgnxupj, T = jgppnuxk |
4 | Halted | 0 ms | 0 KB | - |