# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
340326 | 2020-12-27T12:46:24 Z | scales | Chessboard (IZhO18_chessboard) | C++17 | 285 ms | 4332 KB |
#include <bits/stdc++.h> /*#ifndef LOCAL_RUN #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("fast-math") #pragma GCC target("avx2,tune=native") #endif*/ using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); long long t,i,j,dno,x,y,z,w,m,k,n,x1,tip,g,p,l,r,sum,maxi,kol,v,f,s; cin>>n; cin>>k; z=0; maxi=100000000000; vector<long long> a(k),b(k); for(i=0;i<k;i++) { cin>>a[i]; cin>>b[i]; cin>>x; cin>>y; a[i]--; b[i]--; } vector<long long> viv; for(i=1;i<n;i++) { if(n%i==0) { viv.push_back(i); } } x=viv.size(); for(i=0;i<x;i++) { kol=0; w=viv[i]; //cout<<"w="<<w<<endl; for(j=0;j<k;j++) { //cout<<"a="<<a[j]<<" b="<<b[j]<<" "<<a[j]%(2*w)<<" "<<b[j]%(2*w)<<endl; if((((a[j]%(2*w))<w) && ((b[j]%(2*w))>=w)) ||( ((a[j]%(2*w))>=w) && ((b[j]%(2*w))<w))) { kol++; } } v=(n*n)/(w*w); if(v%2==0) { f=n*n/2; s=n*n/2; } else { s=(n*n-w*w)/2; f=n*n-s; } kol=k-kol; //cout<<"kol="<<kol<<" f="<<f<<" s="<<s<<" maxi="; maxi=min({maxi,(f-kol+k-kol),(kol+s-k+kol)}); //cout<<maxi<<endl; } cout<<maxi<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 2572 KB | Output is correct |
2 | Correct | 7 ms | 1004 KB | Output is correct |
3 | Correct | 16 ms | 1920 KB | Output is correct |
4 | Correct | 18 ms | 1900 KB | Output is correct |
5 | Correct | 28 ms | 2540 KB | Output is correct |
6 | Correct | 14 ms | 1644 KB | Output is correct |
7 | Correct | 4 ms | 620 KB | Output is correct |
8 | Correct | 15 ms | 1644 KB | Output is correct |
9 | Correct | 39 ms | 3948 KB | Output is correct |
10 | Correct | 23 ms | 2412 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 10 ms | 1260 KB | Output is correct |
17 | Correct | 28 ms | 2924 KB | Output is correct |
18 | Correct | 40 ms | 3084 KB | Output is correct |
19 | Correct | 74 ms | 2924 KB | Output is correct |
20 | Correct | 80 ms | 3052 KB | Output is correct |
21 | Correct | 27 ms | 2796 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 23 ms | 1644 KB | Output is correct |
24 | Correct | 33 ms | 2924 KB | Output is correct |
25 | Correct | 4 ms | 620 KB | Output is correct |
26 | Correct | 21 ms | 2156 KB | Output is correct |
27 | Correct | 28 ms | 2540 KB | Output is correct |
28 | Correct | 36 ms | 3052 KB | Output is correct |
29 | Correct | 12 ms | 1388 KB | Output is correct |
30 | Correct | 2 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 2572 KB | Output is correct |
2 | Correct | 7 ms | 1004 KB | Output is correct |
3 | Correct | 16 ms | 1920 KB | Output is correct |
4 | Correct | 18 ms | 1900 KB | Output is correct |
5 | Correct | 28 ms | 2540 KB | Output is correct |
6 | Correct | 14 ms | 1644 KB | Output is correct |
7 | Correct | 4 ms | 620 KB | Output is correct |
8 | Correct | 15 ms | 1644 KB | Output is correct |
9 | Correct | 39 ms | 3948 KB | Output is correct |
10 | Correct | 23 ms | 2412 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 10 ms | 1260 KB | Output is correct |
27 | Correct | 28 ms | 2924 KB | Output is correct |
28 | Correct | 40 ms | 3084 KB | Output is correct |
29 | Correct | 74 ms | 2924 KB | Output is correct |
30 | Correct | 80 ms | 3052 KB | Output is correct |
31 | Correct | 27 ms | 2796 KB | Output is correct |
32 | Correct | 1 ms | 364 KB | Output is correct |
33 | Correct | 23 ms | 1644 KB | Output is correct |
34 | Correct | 33 ms | 2924 KB | Output is correct |
35 | Correct | 4 ms | 620 KB | Output is correct |
36 | Correct | 21 ms | 2156 KB | Output is correct |
37 | Correct | 28 ms | 2540 KB | Output is correct |
38 | Correct | 36 ms | 3052 KB | Output is correct |
39 | Correct | 12 ms | 1388 KB | Output is correct |
40 | Correct | 2 ms | 364 KB | Output is correct |
41 | Correct | 69 ms | 3564 KB | Output is correct |
42 | Correct | 47 ms | 4076 KB | Output is correct |
43 | Correct | 49 ms | 3692 KB | Output is correct |
44 | Correct | 41 ms | 3968 KB | Output is correct |
45 | Correct | 39 ms | 4332 KB | Output is correct |
46 | Correct | 77 ms | 4068 KB | Output is correct |
47 | Correct | 34 ms | 3692 KB | Output is correct |
48 | Correct | 44 ms | 3820 KB | Output is correct |
49 | Correct | 40 ms | 3712 KB | Output is correct |
50 | Correct | 261 ms | 4076 KB | Output is correct |
51 | Correct | 283 ms | 4204 KB | Output is correct |
52 | Correct | 274 ms | 4076 KB | Output is correct |
53 | Correct | 277 ms | 4204 KB | Output is correct |
54 | Correct | 256 ms | 3820 KB | Output is correct |
55 | Correct | 285 ms | 4332 KB | Output is correct |
56 | Correct | 264 ms | 3692 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 27 ms | 2572 KB | Output is correct |
10 | Correct | 7 ms | 1004 KB | Output is correct |
11 | Correct | 16 ms | 1920 KB | Output is correct |
12 | Correct | 18 ms | 1900 KB | Output is correct |
13 | Correct | 28 ms | 2540 KB | Output is correct |
14 | Correct | 14 ms | 1644 KB | Output is correct |
15 | Correct | 4 ms | 620 KB | Output is correct |
16 | Correct | 15 ms | 1644 KB | Output is correct |
17 | Correct | 39 ms | 3948 KB | Output is correct |
18 | Correct | 23 ms | 2412 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 1 ms | 364 KB | Output is correct |
28 | Correct | 1 ms | 364 KB | Output is correct |
29 | Correct | 1 ms | 364 KB | Output is correct |
30 | Correct | 1 ms | 364 KB | Output is correct |
31 | Correct | 1 ms | 364 KB | Output is correct |
32 | Correct | 1 ms | 364 KB | Output is correct |
33 | Correct | 1 ms | 364 KB | Output is correct |
34 | Correct | 10 ms | 1260 KB | Output is correct |
35 | Correct | 28 ms | 2924 KB | Output is correct |
36 | Correct | 40 ms | 3084 KB | Output is correct |
37 | Correct | 74 ms | 2924 KB | Output is correct |
38 | Correct | 80 ms | 3052 KB | Output is correct |
39 | Correct | 27 ms | 2796 KB | Output is correct |
40 | Correct | 1 ms | 364 KB | Output is correct |
41 | Correct | 23 ms | 1644 KB | Output is correct |
42 | Correct | 33 ms | 2924 KB | Output is correct |
43 | Correct | 4 ms | 620 KB | Output is correct |
44 | Correct | 21 ms | 2156 KB | Output is correct |
45 | Correct | 28 ms | 2540 KB | Output is correct |
46 | Correct | 36 ms | 3052 KB | Output is correct |
47 | Correct | 12 ms | 1388 KB | Output is correct |
48 | Correct | 2 ms | 364 KB | Output is correct |
49 | Correct | 69 ms | 3564 KB | Output is correct |
50 | Correct | 47 ms | 4076 KB | Output is correct |
51 | Correct | 49 ms | 3692 KB | Output is correct |
52 | Correct | 41 ms | 3968 KB | Output is correct |
53 | Correct | 39 ms | 4332 KB | Output is correct |
54 | Correct | 77 ms | 4068 KB | Output is correct |
55 | Correct | 34 ms | 3692 KB | Output is correct |
56 | Correct | 44 ms | 3820 KB | Output is correct |
57 | Correct | 40 ms | 3712 KB | Output is correct |
58 | Correct | 261 ms | 4076 KB | Output is correct |
59 | Correct | 283 ms | 4204 KB | Output is correct |
60 | Correct | 274 ms | 4076 KB | Output is correct |
61 | Correct | 277 ms | 4204 KB | Output is correct |
62 | Correct | 256 ms | 3820 KB | Output is correct |
63 | Correct | 285 ms | 4332 KB | Output is correct |
64 | Correct | 264 ms | 3692 KB | Output is correct |
65 | Correct | 1 ms | 364 KB | Output is correct |
66 | Incorrect | 1 ms | 364 KB | Output isn't correct |
67 | Halted | 0 ms | 0 KB | - |