Submission #115070

# Submission time Handle Problem Language Result Execution time Memory
115070 2019-06-05T05:45:25 Z 윤교준(#2865) Lock Puzzle (innopolis2018_final_A) C++14
0 / 100
4 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;
	}

	M = N/2;
	printf("%d\n", M*4);
	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

A.cpp: In function 'int main()':
A.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%*d %s %s", &N, A+1, B+1);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB [n = 1, m = 10000], OK, 0 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 4 operations
3 Incorrect 2 ms 384 KB S is not equal after all operations: S = jxpnpugk, T = jgppnuxk
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB [n = 1, m = 10000], OK, 0 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 4 operations
3 Incorrect 2 ms 384 KB S is not equal after all operations: S = jxpnpugk, T = jgppnuxk
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB [n = 1, m = 10000], OK, 0 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 4 operations
3 Incorrect 2 ms 384 KB S is not equal after all operations: S = jxpnpugk, T = jgppnuxk
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB [n = 1, m = 10000], OK, 0 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 4 operations
3 Incorrect 2 ms 384 KB S is not equal after all operations: S = jxpnpugk, T = jgppnuxk
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB [n = 1, m = 10000], OK, 0 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 4 operations
3 Incorrect 2 ms 384 KB S is not equal after all operations: S = jxpnpugk, T = jgppnuxk
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB [n = 1, m = 10000], OK, 0 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 4 operations
3 Incorrect 2 ms 384 KB S is not equal after all operations: S = jxpnpugk, T = jgppnuxk
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB [n = 1, m = 10000], OK, 0 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 4 operations
3 Incorrect 2 ms 384 KB S is not equal after all operations: S = jxpnpugk, T = jgppnuxk
4 Halted 0 ms 0 KB -