#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const ll N=100005, INF=1e17;
ll n, m, a[N], b[N], c[N], d[N], x, y, Ans=INF, ans1, ans2;
string s;
vector <int> v[N];
/*int abc(int x, int y, int X, int Y, int k, int o){
}*/
int main(){
cin>>n>>m;
for (int i=1; i<=m; i++)
cin>>a[i]>>b[i]>>c[i]>>d[i];
for (int i=1; i<n; i++){
if(n%i==0){ans1=((n/i)*(n/i)+1)/2, ans2=((n/i)*(n/i))/2;
for (int j=1; j<=m; j++){
//ans+=abc(a[j], b[j], c[j], d[j], i, 0);
if(((a[j]-1)/i)%2==1&&((b[j]-1)/i)%2==1) ans1--, ans2++;
else ans1++, ans2--;
}
Ans=min(Ans,min(ans1, ans2));
}
}
cout<<Ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
Output is correct |
2 |
Incorrect |
4 ms |
2680 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
131 ms |
5512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
2680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
2680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
131 ms |
5512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
Output is correct |
2 |
Incorrect |
4 ms |
2680 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |