답안 #48821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48821 2018-05-19T07:45:07 Z mrtsima22 Chessboard (IZhO18_chessboard) C++17
16 / 100
80 ms 9924 KB
#include <bits/stdc++.h>
using namespace std;
#define lo long
const int lmax=1999999999;
const long long lmx=1999999999999999999;
long long n;
long long k;
long long ans=lmax,ansT,ansS;
int a[100003],b[100003],c[100003],d[100004];
int main(){std::ios::sync_with_stdio(false);
cin>>n>>k;
if(k==0LL){
ans=n*n/2;
for(long long j=2;j<=n/2+1;j++)
{
	if(n%j==0)
	{
		long long k=n/j;
		k=k*k;
		ans=min(ans,j*j/2*k);
	}
}
cout<<ans<<endl;
return 0;
}
ansT=ansS=0;
for(int i=0;i<k;i++)
{
	cin>>a[i]>>b[i]>>c[i]>>d[i];
	if(a[i]==c[i]&&b[i]==d[i])
	{
		if((a[i]+b[i])&1)
		{
			ansT++;
		}
		else
		{
			ansS++;
		}
	}	
}
k=n*n/2;
long long K=k;
if(n&1)K++;
ans=min(ansT+K-ansS,ansS+k-ansT);
cout<<ans<<endl;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
               *       * *       *
               *        *        *
                *               *
                 *             *
                  *           *
                   *         *
                    *       *
                     *     *
                      *   *
                       * *
                        *



*/


# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 428 KB Output is correct
4 Correct 2 ms 556 KB Output is correct
5 Correct 3 ms 556 KB Output is correct
6 Correct 2 ms 556 KB Output is correct
7 Correct 2 ms 556 KB Output is correct
8 Correct 2 ms 556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1492 KB Output is correct
2 Correct 11 ms 1492 KB Output is correct
3 Correct 19 ms 2536 KB Output is correct
4 Correct 22 ms 3488 KB Output is correct
5 Correct 31 ms 5008 KB Output is correct
6 Correct 21 ms 5548 KB Output is correct
7 Correct 7 ms 5548 KB Output is correct
8 Correct 32 ms 6440 KB Output is correct
9 Correct 80 ms 9440 KB Output is correct
10 Correct 30 ms 9924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 9924 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 9924 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1492 KB Output is correct
2 Correct 11 ms 1492 KB Output is correct
3 Correct 19 ms 2536 KB Output is correct
4 Correct 22 ms 3488 KB Output is correct
5 Correct 31 ms 5008 KB Output is correct
6 Correct 21 ms 5548 KB Output is correct
7 Correct 7 ms 5548 KB Output is correct
8 Correct 32 ms 6440 KB Output is correct
9 Correct 80 ms 9440 KB Output is correct
10 Correct 30 ms 9924 KB Output is correct
11 Incorrect 2 ms 9924 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 428 KB Output is correct
4 Correct 2 ms 556 KB Output is correct
5 Correct 3 ms 556 KB Output is correct
6 Correct 2 ms 556 KB Output is correct
7 Correct 2 ms 556 KB Output is correct
8 Correct 2 ms 556 KB Output is correct
9 Correct 30 ms 1492 KB Output is correct
10 Correct 11 ms 1492 KB Output is correct
11 Correct 19 ms 2536 KB Output is correct
12 Correct 22 ms 3488 KB Output is correct
13 Correct 31 ms 5008 KB Output is correct
14 Correct 21 ms 5548 KB Output is correct
15 Correct 7 ms 5548 KB Output is correct
16 Correct 32 ms 6440 KB Output is correct
17 Correct 80 ms 9440 KB Output is correct
18 Correct 30 ms 9924 KB Output is correct
19 Incorrect 2 ms 9924 KB Output isn't correct
20 Halted 0 ms 0 KB -