| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 113215 | tutis | Spirale (COCI18_spirale) | C++17 | 147 ms | 604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*input
4 3 2
1 1 0
1 2 0
*/
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 111 * 111;
int ans[50][50];
int dx[sz], dy[sz];
int main()
{
ios_base::sync_with_stdio(false);
int N, M, K;
cin >> N >> M >> K;
int x[K], y[K], t[K];
for (int i = 0; i < K; i++)
{
cin >> y[i] >> x[i] >> t[i];
x[i]--;
y[i]--;
}
dx[0] = dy[0] = 0;
int tim = 1;
int a = 0;
int b = 0;
for (int d = 1; d <= 50; d++)
{
b++;
a--;
for (int c = 0; c <= 2 * d - 1; c++)
{
a++;
dx[tim] = a;
dy[tim] = b;
tim++;
}
for (int c = 0; c <= 2 * d - 1; c++)
{
b--;
dx[tim] = a;
dy[tim] = b;
tim++;
}
for (int c = 0; c <= 2 * d - 1; c++)
{
a--;
dx[tim] = a;
dy[tim] = b;
tim++;
}
for (int c = 0; c <= 2 * d - 1; c++)
{
b++;
dx[tim] = a;
dy[tim] = b;
tim++;
}
}
for (int id = 0; id < sz; id++)
{
for (int i = 0; i < K; i++)
{
int yy = -dy[id] + y[i];
int xx = -(t[i] * 2 - 1) * (dx[id]) + x[i];
if (xx >= 0 && xx < M && yy >= 0 && yy < N && ans[yy][xx] == 0)
ans[yy][xx] = id + 1;
}
}
for (int i = 0; i < N; i++)
{
for (int j = 0; j < M; j++)
{
cout << ans[i][j] << " ";
}
cout << "\n";
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
