| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 40395 | szawinis | Spirale (COCI18_spirale) | C++14 | 86 ms | 788 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n, m, k, f[51][51];
int dx[4] = {-1, 0, 1, 0}, dy[2][4] = {{0, 1, 0, -1}, {0, -1, 0, 1}};
int main() {
scanf("%d %d %d", &n, &m, &k);
for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) f[i][j] = 1e9;
for(int z = 0, x, y, t; z < k; z++) {
scanf("%d %d %d", &x, &y, &t);
f[x][y] = 1;
int elapsed = 1;
for(int i = 1; i <= 200; i++) for(int j = 0; j < i+1 >> 1; j++) {
++elapsed;
x += dx[(i-1) % 4];
y += dy[t][(i-1) % 4];
if(x >= 1 && x <= n && y >= 1 && y <= m) f[x][y] = min(elapsed, f[x][y]);
}
}
for(int i = 1; i <= n; i++, printf("\n")) for(int j = 1; j <= m; j++) printf("%d ", f[i][j]);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
