Submission #168452

# Submission time Handle Problem Language Result Execution time Memory
168452 2019-12-13T06:33:21 Z David_M Chessboard (IZhO18_chessboard) C++14
70 / 100
626 ms 8320 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);
			//cout<<ans1<<" "<<ans2<<endl;
			for (int j=1; j<=m; j++){
				//ans+=abc(a[j], b[j], c[j], d[j], i, 0);
				if((((a[j]-1)/i)+((b[j]-1)/i))%2==0) ans1--, ans2++; 
											else ans1++, ans2--;
			}
			//if(Ans>ans1)Ans=ans1, x=i, y=1;
			//if(Ans>ans2)Ans=ans2, x=i, y=2;
			
			Ans=min(Ans,min(ans1, ans2));
		}
	}
	cout<<Ans/*<<x<<y*/;
}
# 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 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 4 ms 2684 KB Output is correct
8 Correct 4 ms 2680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 132 ms 4972 KB Output is correct
2 Correct 35 ms 3552 KB Output is correct
3 Correct 86 ms 4472 KB Output is correct
4 Correct 83 ms 4600 KB Output is correct
5 Correct 115 ms 4884 KB Output is correct
6 Correct 76 ms 4320 KB Output is correct
7 Correct 19 ms 3196 KB Output is correct
8 Correct 75 ms 4324 KB Output is correct
9 Correct 184 ms 6052 KB Output is correct
10 Correct 105 ms 4736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 4 ms 2684 KB Output is correct
3 Correct 4 ms 2680 KB Output is correct
4 Correct 5 ms 2808 KB Output is correct
5 Correct 5 ms 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 5 ms 2680 KB Output is correct
8 Correct 5 ms 2680 KB Output is correct
9 Correct 5 ms 2680 KB Output is correct
10 Correct 5 ms 2676 KB Output is correct
11 Correct 5 ms 2680 KB Output is correct
12 Correct 5 ms 2680 KB Output is correct
13 Correct 5 ms 2680 KB Output is correct
14 Correct 5 ms 2680 KB Output is correct
15 Correct 5 ms 2680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 4 ms 2684 KB Output is correct
3 Correct 4 ms 2680 KB Output is correct
4 Correct 5 ms 2808 KB Output is correct
5 Correct 5 ms 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 5 ms 2680 KB Output is correct
8 Correct 5 ms 2680 KB Output is correct
9 Correct 5 ms 2680 KB Output is correct
10 Correct 5 ms 2676 KB Output is correct
11 Correct 5 ms 2680 KB Output is correct
12 Correct 5 ms 2680 KB Output is correct
13 Correct 5 ms 2680 KB Output is correct
14 Correct 5 ms 2680 KB Output is correct
15 Correct 5 ms 2680 KB Output is correct
16 Correct 48 ms 3764 KB Output is correct
17 Correct 138 ms 5624 KB Output is correct
18 Correct 160 ms 6100 KB Output is correct
19 Correct 214 ms 5668 KB Output is correct
20 Correct 239 ms 6028 KB Output is correct
21 Correct 135 ms 5464 KB Output is correct
22 Correct 5 ms 2680 KB Output is correct
23 Correct 77 ms 4216 KB Output is correct
24 Correct 147 ms 5804 KB Output is correct
25 Correct 20 ms 3064 KB Output is correct
26 Correct 93 ms 4732 KB Output is correct
27 Correct 116 ms 4984 KB Output is correct
28 Correct 155 ms 5848 KB Output is correct
29 Correct 55 ms 3936 KB Output is correct
30 Correct 8 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 132 ms 4972 KB Output is correct
2 Correct 35 ms 3552 KB Output is correct
3 Correct 86 ms 4472 KB Output is correct
4 Correct 83 ms 4600 KB Output is correct
5 Correct 115 ms 4884 KB Output is correct
6 Correct 76 ms 4320 KB Output is correct
7 Correct 19 ms 3196 KB Output is correct
8 Correct 75 ms 4324 KB Output is correct
9 Correct 184 ms 6052 KB Output is correct
10 Correct 105 ms 4736 KB Output is correct
11 Correct 4 ms 2680 KB Output is correct
12 Correct 4 ms 2684 KB Output is correct
13 Correct 4 ms 2680 KB Output is correct
14 Correct 5 ms 2808 KB Output is correct
15 Correct 5 ms 2680 KB Output is correct
16 Correct 4 ms 2680 KB Output is correct
17 Correct 5 ms 2680 KB Output is correct
18 Correct 5 ms 2680 KB Output is correct
19 Correct 5 ms 2680 KB Output is correct
20 Correct 5 ms 2676 KB Output is correct
21 Correct 5 ms 2680 KB Output is correct
22 Correct 5 ms 2680 KB Output is correct
23 Correct 5 ms 2680 KB Output is correct
24 Correct 5 ms 2680 KB Output is correct
25 Correct 5 ms 2680 KB Output is correct
26 Correct 48 ms 3764 KB Output is correct
27 Correct 138 ms 5624 KB Output is correct
28 Correct 160 ms 6100 KB Output is correct
29 Correct 214 ms 5668 KB Output is correct
30 Correct 239 ms 6028 KB Output is correct
31 Correct 135 ms 5464 KB Output is correct
32 Correct 5 ms 2680 KB Output is correct
33 Correct 77 ms 4216 KB Output is correct
34 Correct 147 ms 5804 KB Output is correct
35 Correct 20 ms 3064 KB Output is correct
36 Correct 93 ms 4732 KB Output is correct
37 Correct 116 ms 4984 KB Output is correct
38 Correct 155 ms 5848 KB Output is correct
39 Correct 55 ms 3936 KB Output is correct
40 Correct 8 ms 2808 KB Output is correct
41 Correct 235 ms 7292 KB Output is correct
42 Correct 204 ms 7928 KB Output is correct
43 Correct 204 ms 7232 KB Output is correct
44 Correct 198 ms 7664 KB Output is correct
45 Correct 210 ms 8056 KB Output is correct
46 Correct 264 ms 7808 KB Output is correct
47 Correct 188 ms 7424 KB Output is correct
48 Correct 206 ms 7564 KB Output is correct
49 Correct 182 ms 7312 KB Output is correct
50 Correct 568 ms 7720 KB Output is correct
51 Correct 607 ms 8056 KB Output is correct
52 Correct 563 ms 7608 KB Output is correct
53 Correct 601 ms 8032 KB Output is correct
54 Correct 556 ms 7536 KB Output is correct
55 Correct 626 ms 8320 KB Output is correct
56 Correct 539 ms 7392 KB Output is correct
# 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 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 4 ms 2684 KB Output is correct
8 Correct 4 ms 2680 KB Output is correct
9 Correct 132 ms 4972 KB Output is correct
10 Correct 35 ms 3552 KB Output is correct
11 Correct 86 ms 4472 KB Output is correct
12 Correct 83 ms 4600 KB Output is correct
13 Correct 115 ms 4884 KB Output is correct
14 Correct 76 ms 4320 KB Output is correct
15 Correct 19 ms 3196 KB Output is correct
16 Correct 75 ms 4324 KB Output is correct
17 Correct 184 ms 6052 KB Output is correct
18 Correct 105 ms 4736 KB Output is correct
19 Correct 4 ms 2680 KB Output is correct
20 Correct 4 ms 2684 KB Output is correct
21 Correct 4 ms 2680 KB Output is correct
22 Correct 5 ms 2808 KB Output is correct
23 Correct 5 ms 2680 KB Output is correct
24 Correct 4 ms 2680 KB Output is correct
25 Correct 5 ms 2680 KB Output is correct
26 Correct 5 ms 2680 KB Output is correct
27 Correct 5 ms 2680 KB Output is correct
28 Correct 5 ms 2676 KB Output is correct
29 Correct 5 ms 2680 KB Output is correct
30 Correct 5 ms 2680 KB Output is correct
31 Correct 5 ms 2680 KB Output is correct
32 Correct 5 ms 2680 KB Output is correct
33 Correct 5 ms 2680 KB Output is correct
34 Correct 48 ms 3764 KB Output is correct
35 Correct 138 ms 5624 KB Output is correct
36 Correct 160 ms 6100 KB Output is correct
37 Correct 214 ms 5668 KB Output is correct
38 Correct 239 ms 6028 KB Output is correct
39 Correct 135 ms 5464 KB Output is correct
40 Correct 5 ms 2680 KB Output is correct
41 Correct 77 ms 4216 KB Output is correct
42 Correct 147 ms 5804 KB Output is correct
43 Correct 20 ms 3064 KB Output is correct
44 Correct 93 ms 4732 KB Output is correct
45 Correct 116 ms 4984 KB Output is correct
46 Correct 155 ms 5848 KB Output is correct
47 Correct 55 ms 3936 KB Output is correct
48 Correct 8 ms 2808 KB Output is correct
49 Correct 235 ms 7292 KB Output is correct
50 Correct 204 ms 7928 KB Output is correct
51 Correct 204 ms 7232 KB Output is correct
52 Correct 198 ms 7664 KB Output is correct
53 Correct 210 ms 8056 KB Output is correct
54 Correct 264 ms 7808 KB Output is correct
55 Correct 188 ms 7424 KB Output is correct
56 Correct 206 ms 7564 KB Output is correct
57 Correct 182 ms 7312 KB Output is correct
58 Correct 568 ms 7720 KB Output is correct
59 Correct 607 ms 8056 KB Output is correct
60 Correct 563 ms 7608 KB Output is correct
61 Correct 601 ms 8032 KB Output is correct
62 Correct 556 ms 7536 KB Output is correct
63 Correct 626 ms 8320 KB Output is correct
64 Correct 539 ms 7392 KB Output is correct
65 Correct 4 ms 2684 KB Output is correct
66 Incorrect 4 ms 2680 KB Output isn't correct
67 Halted 0 ms 0 KB -