#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
const ll N = 2000004;
ll n, m, l, k, t, x,ans, y;
pair<ll, ll> a[N];
int check(int n, int m, int x, int y)
{
x /= m;
y /= m;
if (x + y % 2 == 0)
{
return 1;
}
else
return 0;
}
int main()
{
cin >> n >> m;
for (int i = 0; i < m; ++i)
{
cin >> a[i].first >> a[i].second;
cin >> x >> x;
}
x = 0;
ans = n * n / 2;
if(m!=0)
for (int i = 1; i*i <= n; ++i)
{
if (n%i == 0)
{
for (int j = 0; j < m; ++j)
{
x += check(n, i, a[j].first-1, a[j].second-1);
}
ans = min(x, n*n/2 - x);
}
x = 0;
}
cout << ans << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
86 ms |
1244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
86 ms |
1244 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |