#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 (ll i=1; i<n; i++){
if(n%i==0){ans1=(((n/i)*(n/i)+1)/2)*(i*i), ans2=(((n/i)*(n/i))/2)*(i*i);
for (int j=1; j<=m; j++){
//ans+=abc(a[j], b[j], c[j], d[j], i, 0);
if((((a[j])/i)+((b[j])/i))%2==0) 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 |
Correct |
4 ms |
2680 KB |
Output is correct |
3 |
Correct |
4 ms |
2680 KB |
Output is correct |
4 |
Correct |
4 ms |
2680 KB |
Output is correct |
5 |
Correct |
4 ms |
2680 KB |
Output is correct |
6 |
Correct |
4 ms |
2680 KB |
Output is correct |
7 |
Correct |
4 ms |
2680 KB |
Output is correct |
8 |
Correct |
4 ms |
2680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
137 ms |
5536 KB |
Output is correct |
2 |
Correct |
36 ms |
3576 KB |
Output is correct |
3 |
Correct |
86 ms |
4856 KB |
Output is correct |
4 |
Correct |
83 ms |
4920 KB |
Output is correct |
5 |
Correct |
115 ms |
5752 KB |
Output is correct |
6 |
Correct |
76 ms |
4600 KB |
Output is correct |
7 |
Correct |
19 ms |
3064 KB |
Output is correct |
8 |
Correct |
78 ms |
4604 KB |
Output is correct |
9 |
Correct |
184 ms |
7652 KB |
Output is correct |
10 |
Correct |
105 ms |
5368 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
Correct |
137 ms |
5536 KB |
Output is correct |
2 |
Correct |
36 ms |
3576 KB |
Output is correct |
3 |
Correct |
86 ms |
4856 KB |
Output is correct |
4 |
Correct |
83 ms |
4920 KB |
Output is correct |
5 |
Correct |
115 ms |
5752 KB |
Output is correct |
6 |
Correct |
76 ms |
4600 KB |
Output is correct |
7 |
Correct |
19 ms |
3064 KB |
Output is correct |
8 |
Correct |
78 ms |
4604 KB |
Output is correct |
9 |
Correct |
184 ms |
7652 KB |
Output is correct |
10 |
Correct |
105 ms |
5368 KB |
Output is correct |
11 |
Incorrect |
4 ms |
2680 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2680 KB |
Output is correct |
2 |
Correct |
4 ms |
2680 KB |
Output is correct |
3 |
Correct |
4 ms |
2680 KB |
Output is correct |
4 |
Correct |
4 ms |
2680 KB |
Output is correct |
5 |
Correct |
4 ms |
2680 KB |
Output is correct |
6 |
Correct |
4 ms |
2680 KB |
Output is correct |
7 |
Correct |
4 ms |
2680 KB |
Output is correct |
8 |
Correct |
4 ms |
2680 KB |
Output is correct |
9 |
Correct |
137 ms |
5536 KB |
Output is correct |
10 |
Correct |
36 ms |
3576 KB |
Output is correct |
11 |
Correct |
86 ms |
4856 KB |
Output is correct |
12 |
Correct |
83 ms |
4920 KB |
Output is correct |
13 |
Correct |
115 ms |
5752 KB |
Output is correct |
14 |
Correct |
76 ms |
4600 KB |
Output is correct |
15 |
Correct |
19 ms |
3064 KB |
Output is correct |
16 |
Correct |
78 ms |
4604 KB |
Output is correct |
17 |
Correct |
184 ms |
7652 KB |
Output is correct |
18 |
Correct |
105 ms |
5368 KB |
Output is correct |
19 |
Incorrect |
4 ms |
2680 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |