Submission #58689897
Source Code Expand
Copy
#include<bits/stdc++.h>using namespace std;int n;char g[3005][3005], res[3005][3005];int main() {cin >> n;for (int i = 1; i <= n; i++)cin >> (g[i] + 1);for (int i = 1; i <= n; i++) {for (int j = 1; j <= n; j++) {int circ = min(min(i, n - i + 1), min(j, n - j + 1)) % 4;int x = i, y = j;while (circ--) {int px = y, py = n + 1 - x;x = px, y = py;}res[x][y] = g[i][j];}}for (int i = 1; i <= n; i++) {cout << (res[i] + 1) << endl;
#include<bits/stdc++.h> using namespace std; int n; char g[3005][3005], res[3005][3005]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> (g[i] + 1); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { int circ = min(min(i, n - i + 1), min(j, n - j + 1)) % 4; int x = i, y = j; while (circ--) { int px = y, py = n + 1 - x; x = px, y = py; } res[x][y] = g[i][j]; } } for (int i = 1; i <= n; i++) { cout << (res[i] + 1) << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Spiral Rotation |
User | Tianyiwei |
Language | C++ 17 (gcc 12.2) |
Score | 400 |
Code Size | 636 Byte |
Status | AC |
Exec Time | 128 ms |
Memory | 27120 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample00.txt, sample01.txt, sample02.txt |
All | sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample00.txt | AC | 1 ms | 3628 KB |
sample01.txt | AC | 1 ms | 3540 KB |
sample02.txt | AC | 1 ms | 3568 KB |
testcase00.txt | AC | 1 ms | 3512 KB |
testcase01.txt | AC | 1 ms | 3448 KB |
testcase02.txt | AC | 128 ms | 27052 KB |
testcase03.txt | AC | 126 ms | 27040 KB |
testcase04.txt | AC | 128 ms | 27120 KB |
testcase05.txt | AC | 2 ms | 3700 KB |
testcase06.txt | AC | 1 ms | 3736 KB |
testcase07.txt | AC | 1 ms | 3644 KB |
testcase08.txt | AC | 1 ms | 3540 KB |
testcase09.txt | AC | 1 ms | 3500 KB |
testcase10.txt | AC | 1 ms | 3676 KB |
testcase11.txt | AC | 6 ms | 6932 KB |
testcase12.txt | AC | 9 ms | 7652 KB |
testcase13.txt | AC | 14 ms | 9020 KB |
testcase14.txt | AC | 9 ms | 7772 KB |
testcase15.txt | AC | 8 ms | 7424 KB |
testcase16.txt | AC | 11 ms | 8272 KB |
testcase17.txt | AC | 13 ms | 8884 KB |
testcase18.txt | AC | 10 ms | 8104 KB |
testcase19.txt | AC | 9 ms | 7844 KB |
testcase20.txt | AC | 10 ms | 7968 KB |
testcase21.txt | AC | 14 ms | 8968 KB |
testcase22.txt | AC | 13 ms | 8844 KB |
testcase23.txt | AC | 6 ms | 6592 KB |
testcase24.txt | AC | 8 ms | 7520 KB |
testcase25.txt | AC | 8 ms | 7444 KB |
testcase26.txt | AC | 16 ms | 9300 KB |
testcase27.txt | AC | 12 ms | 8648 KB |
testcase28.txt | AC | 12 ms | 8612 KB |
testcase29.txt | AC | 6 ms | 6736 KB |
testcase30.txt | AC | 7 ms | 7120 KB |
testcase31.txt | AC | 7 ms | 7060 KB |
testcase32.txt | AC | 8 ms | 7508 KB |