Submission #113206

# Submission time Handle Problem Language Result Execution time Memory
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);
  ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -