Submission #168444

# Submission time Handle Problem Language Result Execution time Memory
168444 2019-12-13T06:17:57 Z David_M Chessboard (IZhO18_chessboard) C++14
8 / 100
131 ms 5372 KB
#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)%2==1&&((b[j])/i)%2==1) ans1--, ans2++; 
													else ans1++, ans2--;
			}
			Ans=min(Ans,min(ans1, ans2));
		}
	}
	cout<<Ans;
}
# Verdict Execution time Memory 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 2744 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
# Verdict Execution time Memory Grader output
1 Incorrect 131 ms 5372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 131 ms 5372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 2744 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 Incorrect 131 ms 5372 KB Output isn't correct
10 Halted 0 ms 0 KB -