#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
char c[n][m];
string ans = "";
for(int i = 0; i < n; i ++)
for(int j = 0; j < m ; j++)
cin >> c[i][j], ans += '.';
for(int i = 0; i < n; i ++)
for(int j = 0; j < m; j ++)
{
string s;
for(int li = 0; li < n; li++)
for(int lj = 0; lj < m; lj++)
s += c[(i + li) % n][(j + lj) % m];
ans = min(ans, s);
}
for(int i = 0; i < n; i ++)
{
for(int j = 0; j < m; j ++)
cout << ans[i * m + j];
cout << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
348 KB |
Output is correct |
2 |
Correct |
19 ms |
348 KB |
Output is correct |
3 |
Correct |
19 ms |
348 KB |
Output is correct |
4 |
Correct |
18 ms |
348 KB |
Output is correct |
5 |
Correct |
18 ms |
348 KB |
Output is correct |
6 |
Correct |
22 ms |
348 KB |
Output is correct |
7 |
Correct |
21 ms |
448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
348 KB |
Output is correct |
2 |
Correct |
19 ms |
348 KB |
Output is correct |
3 |
Correct |
19 ms |
348 KB |
Output is correct |
4 |
Correct |
18 ms |
348 KB |
Output is correct |
5 |
Correct |
18 ms |
348 KB |
Output is correct |
6 |
Correct |
22 ms |
348 KB |
Output is correct |
7 |
Correct |
21 ms |
448 KB |
Output is correct |
8 |
Execution timed out |
3042 ms |
860 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
348 KB |
Output is correct |
2 |
Correct |
19 ms |
348 KB |
Output is correct |
3 |
Correct |
19 ms |
348 KB |
Output is correct |
4 |
Correct |
18 ms |
348 KB |
Output is correct |
5 |
Correct |
18 ms |
348 KB |
Output is correct |
6 |
Correct |
22 ms |
348 KB |
Output is correct |
7 |
Correct |
21 ms |
448 KB |
Output is correct |
8 |
Execution timed out |
3042 ms |
860 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |