# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
83348 | charlies_moo | Spirale (COCI18_spirale) | C++17 | 19 ms | 744 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <cstring>
int main() {
int n, m, k;
scanf("%d %d %d", &n, &m, &k);
int a[155][155];
memset(a, 0, sizeof(a));
int dx[2][4] = {{-1, 0, 1, 0}, {-1, 0, 1, 0}};
int dy[2][4] = {{0, 1, 0, -1}, {0, -1, 0, 1}};
for (int i = 0; i < k; i++) {
int x, y, t;
scanf("%d %d %d", &x, &y, &t);
x += 50, y += 50;
int q = 1, r = 0;
while (q < 51 * 51) {
for (int j = 0; j < (r+2)/2; j++) {
if (a[x][y] == 0 || q < a[x][y]) {
a[x][y] = q;
}
x += dx[t][r%4];
y += dy[t][r%4];
q++;
}
r++;
}
}
for (int i = 51; i < 51 + n; i++) {
for (int j = 51; j < 51 + m; j++) {
printf("%d%c", a[i][j], j == 50 + m ? '\n' : ' ');
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |