# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
684156 | mychecksedad | Chessboard (IZhO18_chessboard) | C++17 | 67 ms | 896 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define all(x) x.begin() x.end()
#define MOD (1e9+7)
const int N = 1e6;
int n, k;
vector<pair<int, int>> v;
void solve(){
cin >> n >> k;
int a = 0;
for(int i = 0; i < k; ++i){
int x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2;
v.pb({x1-1,y1-1});
}
int ans = MOD;
for(int i = 1; i < n; ++i){
if(n % i == 0){
for(int rep = 0; rep < 2; ++rep){
int c = 0;
for(int j = 0; j < k; ++j){
bool type = (v[j].first / i + v[j].second / i) % 2;
c -= type ^ rep;
}
ans = min(ans, c + (rep ? ((n/i)*(n/i)/2)*i*i : (((n/i)*(n/i) + 1)/2)*i*i));
}
}
}
cout << ans;
}
int main(){
solve();
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... |