답안 #93161

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
93161 2019-01-06T16:11:23 Z Makhsud Chessboard (IZhO18_chessboard) C++17
8 / 100
74 ms 1756 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll n, k, cnt, x, y, xx, yy;
ll a[50005][3][3];
vector <ll> d;

int main()
{
	cin >> n >> k;
	for ( int i = 1; i < n; i ++ ) {
		if ( n % i == 0 ) {
			d.push_back(i);
		}
	}
	for ( int i = 1; i <= k; i ++ ) {
		cin >> x >> y >> xx >> yy;
		ll r, c;
		for ( auto e: d ) {
			r = (x/e) + ( (x%e) && 1 );
			c = (y/e) + ( (y%e) && 1 );
			a[e][r%2][c%2] ++;
		}
	}
	ll ans1, ans2, mn = INT_MAX;
	for ( auto e: d ) {
		ans1 = ans2 = 0;
		for ( int i = 1; i <= (n/e); i ++ ) {
			if ( i % 2 == 1 ) {
				ans1 += (e*e) * ( (n/e) / 2 );
				ans2 += (e*e) * ( ( (n/e) + 1 ) / 2 );
			} else {
				ans1 += (e*e) * ( ( (n/e) + 1 ) / 2 );
				ans2 += (e*e) * ( (n/e) / 2 );
			}
		}
		mn = min ( mn, min ( ans1, ans2 ) );
	}
	cout << mn;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 74 ms 1756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 74 ms 1756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Incorrect 74 ms 1756 KB Output isn't correct
10 Halted 0 ms 0 KB -