| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1018501 | vjudge1 | Spirale (COCI18_spirale) | C++17 | 78 ms | 348 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int n, m, k, ans[N][N], mat[N][N];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
// U R D L
vector<int> vec;
bool valid(int x, int y){
    return (x > 0 and y > 0 and x <= n and y <= m);
}
void work(int x, int y, int t){
    int cur = 1;
    for (int i = 0; i < vec.size(); i ++){
        int d = i % 4;
        
        if (t) d *= -1;
        d = (d + 4) % 4;
        for (int j = 0; j < vec[i]; j ++){
            x += dx[d];
            y += dy[d];
            cur++;
            if (valid(x, y)){
                mat[x][y] = cur;
                ans[x][y] = min(ans[x][y], mat[x][y]);
            }
        }
    }
}
int main(){
    memset(ans, 31, sizeof ans);
    for (int i = 1; i <= 100; i ++)
        vec.push_back(i), vec.push_back(i);
    cin >> n >> m >> k;
    for (int i = 0; i < k; i ++){
        int x, y, t;
        cin >> x >> y >> t;
        memset(mat, 31, sizeof mat);
        ans[x][y] = mat[x][y] = 1;
        work(x, y, t);
    }
    for (int i = 1; i <= n; i ++){
        for (int j = 1; j <= m; j ++)
            cout << ans[i][j] << " ";
        cout << endl;
    }
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
