# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
768770 | rainboy | Chessboard (IZhO18_chessboard) | C11 | 290 ms | 4228 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#define N 100000
#define INF 0x3f3f3f3f3f3f3f3fLL
long long min(long long a, long long b) { return a < b ? a : b; }
int f(int s, int a) {
a %= s * 2;
return min(a, s * 2 - a);
}
int main() {
static int xx1[N], yy1[N], xx2[N], yy2[N];
int n, s, t, i;
long long k, k_;
scanf("%d%d", &s, &n);
for (i = 0; i < n; i++)
scanf("%d%d%d%d", &xx1[i], &yy1[i], &xx2[i], &yy2[i]), xx1[i]--, yy1[i]--;
k_ = INF;
for (t = 1; t < s; t++)
if (s % t == 0) {
k = (long long) (s / t) * (s / t) / 2 * t * t;
for (i = 0; i < n; i++)
k += (long long) (f(t, xx2[i]) - f(t, xx1[i])) * (f(t, yy2[i]) - f(t, yy1[i]));
k_ = min(k_, min(k, (long long) s * s - k));
}
printf("%lld\n", k_);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |