# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
283693 | 2020-08-26T05:40:35 Z | arnold518 | Lock Puzzle (innopolis2018_final_A) | C++14 | 0 ms | 256 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 2000; int N, M; char S[MAXN+10]; char T[MAXN+10]; int cnt[30]; vector<int> V; void f(int x) { reverse(S+1, S+x+1); V.push_back(x); V.push_back(1); } int main() { scanf("%d%d", &N, &M); scanf(" %s", S+1); scanf(" %s", T+1); for(int i=1; i<=N; i++) cnt[S[i]-'a']++, cnt[T[i]-'a']--; for(int i=0; i<26; i++) if(cnt[i]!=0) return !printf("-1\n"); for(int i=N; i>=1; i--) { if(S[i]==T[i]) continue; int p; for(int j=1; j<i; j++) if(S[j]==T[i]) { p=j; break; } f(p); f(i); } printf("%d\n", V.size()); for(auto it : V) printf("%d ", it); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = hd, T = dh |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = hd, T = dh |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = hd, T = dh |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = hd, T = dh |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = hd, T = dh |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = hd, T = dh |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | [n = 1, m = 10000], OK, 0 operations |
2 | Incorrect | 0 ms | 256 KB | S is not equal after all operations: S = hd, T = dh |
3 | Halted | 0 ms | 0 KB | - |