Submission #43882

# Submission time Handle Problem Language Result Execution time Memory
43882 2018-03-27T05:46:20 Z Tenuun Chessboard (IZhO18_chessboard) C++11
0 / 100
88 ms 1920 KB
#include<bits/stdc++.h>

using namespace std;

int main(){
	int n, k, x, y, x1, y1, res=INT_MAX;
	cin >> n >> k;
	vector<int>fac;
	map<int, int>map;
	for(int i=1; i<n; i++){
		if(n%i==0){
			fac.push_back(i);
		}
	}
	for(int j=0; j<k; j++){
		cin >> x >> y >> x1 >> y1;
		for(int i=0; i<fac.size(); i++){
			if((x%(2*fac[i])>=1 && x%(2*fac[i])<=fac[i] && y%(2*fac[i])<=fac[i]&&y%(2*fac[i])>=1) ||((x%(2*fac[i])==0 || x%(2*fac[i])>fac[i]) && (y%(2*fac[i])>fac[i]||y%(2*fac[i])==0)) )map[i+1]++;
		}
	}
	int i=0;
	for (auto it=map.begin(); it!=map.end(); ++it){
		int res1, res2;
		//cout << it->first << it->second << endl;
		
		res1=(n*n-fac[i]*fac[i])/2+fac[i]*fac[i]-it->second+k-it->second;
		res2=it->second+(n*n-fac[i]*fac[i])/2-(k-it->second);
		res2=n*n-res1;
		cout << it->second << " " << res1 << " " << res2 << endl;
		res=min(res, res1);
		res=min(res, res2);
		i++;
	}
	cout << res;
    return 0;
}

Compilation message

chessboard.cpp: In function 'int main()':
chessboard.cpp:17:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0; i<fac.size(); i++){
                ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 1904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1920 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1920 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 1904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -