| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 340369 | scales | Chessboard (IZhO18_chessboard) | C++17 | 508 ms | 5580 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
/*#ifndef LOCAL_RUN
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("unroll-loops")
    #pragma GCC optimize("fast-math")
    #pragma GCC target("avx2,tune=native")
#endif*/
using namespace std;
int main()
{
      ios::sync_with_stdio(false);
      cin.tie(0);
     // freopen("input.txt","r",stdin);
     // freopen("output.txt","w",stdout);
     long long t,i,j,dno,x,y,z,w,m,k,n,x1,y1,tip,g,p,l,r,sum,maxi,kol,v,f,s,h,z1;
     dno=0;
     cin>>n;
     cin>>k;
     z=0;
     tip=0;
     maxi=100000000000;
     vector<long long> a(k),b(k),c(k),d(k);
     for(i=0;i<k;i++)
     {
         cin>>a[i];
         cin>>b[i];
         cin>>c[i];
         cin>>d[i];
         a[i]--;
         b[i]--;
         c[i]--;
         d[i]--;
         tip=tip+(c[i]-a[i]+1)*(d[i]-b[i]+1);
     }
     vector<long long> viv;
     for(i=1;i<n;i++)
     {
         if(n%i==0)
         {
             viv.push_back(i);
         }
     }
     z1=viv.size();
     //cout<<"tip="<<tip<<endl;
     //cout<<"z1="<<z1<<endl;
        for(i=0;i<z1;i++)
        {
             kol=0;
             w=viv[i];
             //cout<<"w="<<w<<endl;
             //cout<<"w="<<w<<endl;
             for(j=0;j<k;j++)
             {
                 //cout<<"a="<<a[j]<<" b="<<b[j]<<" "<<a[j]%(2*w)<<" "<<b[j]%(2*w)<<endl;
                 z=(c[j]-a[j])/(2*w);
                 g=z*w;
                 x=a[j]%(2*w);
                 y=c[j]%(2*w);
                 if(x<=y)
                 {
                     l=x;
                     r=min(w-1,y);
                 }
                 else
                 {
                     if(x>y)
                     {
                        l=0;
                        r=min(w-1,y);
                     }
                     else
                     {
                         r=0;
                         l=1;
                     }
                 }
                 g=g+max(dno,(r-l+1));
                 z=(d[j]-b[j])/(2*w);
                 x=b[j]%(2*w);
                 y=d[j]%(2*w);
                 h=z*w;
                   // cout<<"h="<<h<<" z="<<z<<endl;
                 if(x<=y)
                 {
                     l=x;
                     r=min(w-1,y);
                 }
                 else
                 {
                     if(x>y)
                     {
                        l=0;
                        r=min(w-1,y);
                     }
                     else
                     {
                         r=0;
                         l=1;
                     }
                 }
                 //cout<<"h="<<h<<" dno="<<dno<<endl;
                 h=h+max(dno,(r-l+1));
                 //cout<<"g="<<g<<" h="<<h<<endl;
                 kol=kol+g*(d[j]-b[j]+1-h)+h*(c[j]-a[j]+1-g);
             }
             v=(n*n)/(w*w);
             if(v%2==0)
             {
                 f=n*n/2;
                 s=n*n/2;
             }
             else
             {
                 s=(n*n-w*w)/2;
                 f=n*n-s;
             }
             kol=tip-kol;
             //cout<<"kol="<<kol<<" f="<<f<<" s="<<s<<" maxi=";
             maxi=min({maxi,(f-kol+tip-kol),(kol+s-tip+kol)});
             //cout<<maxi<<endl;
        }
        cout<<maxi<<endl;
    return 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... | ||||
