답안 #88085

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88085 2018-12-03T18:23:23 Z cvetoslav Chessboard (IZhO18_chessboard) C++17
0 / 100
29 ms 508 KB
#include<bits/stdc++.h>
using namespace std;
void freesubtask1(int n)
{
    int minx=n*n;
    for(int d=2;d*d<=n;d++)
    {
        if(n%d==0)
        {
            int x=n/d;
            minx=min(minx,d*d/2*x*x);
        }
    }
    cout<<minx<<endl;
}
void freesubtask2(int n,int k)
{
    int br1=0,br2=0;
    for(int i=0;i<k;i++)
    {
        int x,y;
        cin>>x>>y>>x>>y;
        if(x%2==y%2) br1++;
        else br2++;
    }
    cout<<min(n*n/2-br2+br1,n*n/2+n%2-br1+br2)<<endl;
}
bool is_prime(int n)
{
    for(int i=2;i*i<=n;i++)
        if(n%i==0) return 0;
    return 1;
}
int main()
{
    ios_base::sync_with_stdio(0);
    srand(time(0));
    int n,k;
    cin>>n>>k;
    if(k==0) freesubtask1(n);
    else if(is_prime(n)) freesubtask2(n,k);
    else cout<<n*n/2<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -