답안 #137828

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
137828 2019-07-28T10:24:17 Z vardan__02 Chessboard (IZhO18_chessboard) C++14
16 / 100
41 ms 2424 KB
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
ll n,k,p,u,ans,color[105],i,j,qanak[105],v,x,y;
void entaxndir1();
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    if(k==0)
    {
        entaxndir1();
        return 0;
    }
    for(i=1;i<=k;i++)
    {
        cin>>x>>y>>x>>y;
        if(x%2==y%2)
            u++;
        else
            v++;
    }
    p=n*n/2+1-u+v;
    ans=n*n/2-v+u;
    cout<<min(ans,p)<<endl;
    return 0;
}
void entaxndir1()
{
    ll x,i,u,ans;
    x=n;
    for(i=2;i<=n;i++)
    {
        if(n%i==0)
        {
            while(n%i==0)
            {
                qanak[i]++;
                n/=i;
            }
        }
    }
    for(i=x;i>=2;i--)
    {
        if(qanak[i]!=0)
        {
            u=i;
            break;
        }
    }
    x/=u;
    ans=u*u/2;
    ans=ans*x*x;
    x*=u;
    for(i=2;i<=x;i++)
    {
        if(qanak[i]!=0)
        {
            n=i;
            break;
        }
    }
    x/=n;
    n=n*n/2;
    ans=min(ans,n*x*x);
    cout<<ans<<endl;
}

Compilation message

chessboard.cpp: In function 'void entaxndir1()':
chessboard.cpp:71:6: warning: 'u' may be used uninitialized in this function [-Wmaybe-uninitialized]
     x*=u;
     ~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 1752 KB Output is correct
2 Correct 9 ms 760 KB Output is correct
3 Correct 19 ms 1316 KB Output is correct
4 Correct 20 ms 1272 KB Output is correct
5 Correct 25 ms 1628 KB Output is correct
6 Correct 17 ms 1272 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 17 ms 1116 KB Output is correct
9 Correct 41 ms 2424 KB Output is correct
10 Correct 25 ms 1528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 1752 KB Output is correct
2 Correct 9 ms 760 KB Output is correct
3 Correct 19 ms 1316 KB Output is correct
4 Correct 20 ms 1272 KB Output is correct
5 Correct 25 ms 1628 KB Output is correct
6 Correct 17 ms 1272 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 17 ms 1116 KB Output is correct
9 Correct 41 ms 2424 KB Output is correct
10 Correct 25 ms 1528 KB Output is correct
11 Incorrect 2 ms 376 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 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 28 ms 1752 KB Output is correct
10 Correct 9 ms 760 KB Output is correct
11 Correct 19 ms 1316 KB Output is correct
12 Correct 20 ms 1272 KB Output is correct
13 Correct 25 ms 1628 KB Output is correct
14 Correct 17 ms 1272 KB Output is correct
15 Correct 6 ms 504 KB Output is correct
16 Correct 17 ms 1116 KB Output is correct
17 Correct 41 ms 2424 KB Output is correct
18 Correct 25 ms 1528 KB Output is correct
19 Incorrect 2 ms 376 KB Output isn't correct
20 Halted 0 ms 0 KB -