이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
/*
* *
* * * *
* * * *
* * * *
* * * *
* * *
* *
* *
* *
* *
* *
* *
* *
* *
*
*/
# | 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... |