| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 153924 | theboatman | Chessboard (IZhO18_chessboard) | C++17 | 664 ms | 5804 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define y1 theboatman
#define make_struct(args...) {args}
#define int long long
using namespace std;
struct sqr {
int x, y, x1, y1;
};
int get(int n, int len, vector <sqr> &a) {
int col_sqr = (n * n) / (len * len);
int res = (col_sqr / 2) * len * len;
for(auto i : a) {
int x = i.x, y = i.y;
int color = (i.x - 1) / len + (i.y - 1) / len;
if (color % 2 == 0) {
res++;
}
else {
res--;
}
}
int res1 = ( (col_sqr + 1) / 2) * len * len;
for(auto i : a) {
int x = i.x, y = i.y;
int color = (i.x - 1) / len + (i.y - 1) / len;
if (color % 2 == 1) {
res1++;
}
else {
res1--;
}
}
return min(res, res1);
}
int32_t main() {
cin.tie(0);
ios :: sync_with_stdio(0);
int n, k;
cin >> n >> k;
vector <sqr> a(k);
for(int i = 0; i < k; i++) {
cin >> a[i].x >> a[i].y >> a[i].x1 >> a[i].y1;
}
int ans = n * n;
for(int i = 1; i < n; i++) {
if (n % i == 0) {
ans = min(ans, get(n, i, a));
}
}
cout << ans << "\n";
return 0;
}
/*
cost: ???
*/
컴파일 시 표준 에러 (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... | ||||
