Submission #49921973


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
namespace lzyqwq {
    const int N = 1005; int n, m, k, x = 1, y = 1; bool op[N][N];
    int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1}, st = 0;
    void Main() {
        cin.tie(0), cout.tie(0), ios::sync_with_stdio(0); cin >> n >> m >> k;
        while (k--) {
            if (op[x][y]) {
                op[x][y] = 0; st = (st + 3) % 4;
            } else op[x][y] = 1, st = (st + 1) % 4;
            x += dx[st], y += dy[st];
            if (x > n) x = 1; if (y > m) y = 1;
            if (x < 1) x = n; if (y < 1) y = m;
        }
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= m; ++j) 
                if (op[i][j]) cout << '#'; else cout << '.';
            cout << '\n';
        }
    }
}
signed main() { return lzyqwq::Main(), 0; }

Submission Info

Submission Time
Task B - Langton's Takahashi
User newbie_lzy
Language C++ 20 (gcc 12.2)
Score 250
Code Size 833 Byte
Status AC
Exec Time 1 ms
Memory 3612 KiB

Compile Error

Main.cpp: In function ‘void lzyqwq::Main()’:
Main.cpp:13:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   13 |             if (x > n) x = 1; if (y > m) y = 1;
      |             ^~
Main.cpp:13:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   13 |             if (x > n) x = 1; if (y > m) y = 1;
      |                               ^~
Main.cpp:14:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   14 |             if (x < 1) x = n; if (y < 1) y = m;
      |             ^~
Main.cpp:14:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   14 |             if (x < 1) x = n; if (y < 1) y = m;
      |                               ^~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 3
AC × 15
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
Case Name Status Exec Time Memory
sample00.txt AC 1 ms 3456 KiB
sample01.txt AC 1 ms 3468 KiB
sample02.txt AC 1 ms 3464 KiB
testcase00.txt AC 1 ms 3524 KiB
testcase01.txt AC 1 ms 3416 KiB
testcase02.txt AC 1 ms 3456 KiB
testcase03.txt AC 1 ms 3408 KiB
testcase04.txt AC 1 ms 3476 KiB
testcase05.txt AC 1 ms 3612 KiB
testcase06.txt AC 1 ms 3348 KiB
testcase07.txt AC 1 ms 3432 KiB
testcase08.txt AC 1 ms 3460 KiB
testcase09.txt AC 1 ms 3444 KiB
testcase10.txt AC 1 ms 3548 KiB
testcase11.txt AC 1 ms 3444 KiB