# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
91829 | emil_physmath | Chessboard (IZhO18_chessboard) | C++14 | 26 ms | 1272 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
#include <set>
using namespace std;
const int MAXK=100005;
int mini[MAXK], maxi[MAXK], minj[MAXK], maxj[MAXK];
int IsWhite(int, int);
int FindAns(int n, int k);
int main()
{
int n, k;
cin>>n>>k;
for (int i=0; i<k; i++)
scanf("%d%d%d%d", mini+i, minj+i, maxi+i, maxj+i);
cout<<FindAns(n, k)<<'\n';
char I;
cin >> I;
return 0;
}
int FindAns(int n, int k)
{
int shouldWhite=0, shouldBlack=(n*n)/2;
for (int i=0; i<k; i++)
{
if (IsWhite(maxi[i], maxj[i]))
shouldWhite++;
else
shouldBlack--;
}
return min(shouldWhite+shouldBlack, n*n-(shouldWhite+shouldBlack));
}
int IsWhite(int i, int j)
{
return ((i+j)%2==0);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |