답안 #113206

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113206 2019-05-24T10:30:47 Z 김세빈(#2857) Lock Puzzle (innopolis2018_final_A) C++14
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

char A[2020], B[2020], C[2020];
vector <int> V;
int n, m;

void shift(int p)
{
	reverse(A, A + n);
	reverse(A + n - p, A + n);
}

int main()
{
	int i, j;
	
	scanf("%d%d", &n, &m);
	scanf("%s%s", A, B);
	
	for(i=n-1; i>=0; i--){
		for(j=0; j<=i; j++){
			if(A[j] == B[i]) break;
		}
		
		if(j > i){
			printf("-1\n");
			return 0;
		}
		
		V.push_back(j + 1); shift(j + 1);
		V.push_back(n - 1); shift(n - 1);
		V.push_back(n - i); shift(n - i);
	}
	
	printf("%d\n", 3 * n);
	
	for(int &t: V) printf("%d ", n - t);
	
	printf("\n");
	
	return 0;
}

Compilation message

A.cpp: In function 'int main()':
A.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
A.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s%s", A, B);
  ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB [n = 1, m = 10000], OK, 3 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 6 operations
3 Incorrect 2 ms 256 KB S is not equal after all operations: S = jpnxkupg, T = jgppnuxk
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB [n = 1, m = 10000], OK, 3 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 6 operations
3 Incorrect 2 ms 256 KB S is not equal after all operations: S = jpnxkupg, T = jgppnuxk
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB [n = 1, m = 10000], OK, 3 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 6 operations
3 Incorrect 2 ms 256 KB S is not equal after all operations: S = jpnxkupg, T = jgppnuxk
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB [n = 1, m = 10000], OK, 3 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 6 operations
3 Incorrect 2 ms 256 KB S is not equal after all operations: S = jpnxkupg, T = jgppnuxk
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB [n = 1, m = 10000], OK, 3 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 6 operations
3 Incorrect 2 ms 256 KB S is not equal after all operations: S = jpnxkupg, T = jgppnuxk
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB [n = 1, m = 10000], OK, 3 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 6 operations
3 Incorrect 2 ms 256 KB S is not equal after all operations: S = jpnxkupg, T = jgppnuxk
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB [n = 1, m = 10000], OK, 3 operations
2 Correct 2 ms 256 KB [n = 2, m = 10000], OK, 6 operations
3 Incorrect 2 ms 256 KB S is not equal after all operations: S = jpnxkupg, T = jgppnuxk
4 Halted 0 ms 0 KB -