색칠1

PHOTO EMBED

Mon Mar 11 2024 11:46:02 GMT+0000 (Coordinated Universal Time)

Saved by @hajinjang0714

#include <iostream>
#include <algorithm>
using namespace std;
long long w, h, s, g, x1, y1, x2, y2, sum1, sum2, y, tot, n;
int main()
{
    cin>>w>>h>>s>>g>>x1>>y1>>x2>>y2;
    y=(y2-y1)*(g+1);
    s=min(s, w-s);
    if(s<x1)
    {
        sum2=x2-x1;
    }
    else if(x2>s)
    {
        sum1=2*(s-x1);
        sum2=x2-s;
    }
    else
    {
        sum1=2*(x2-x1);
    }
    tot=w*h-y*(sum1+sum2);
    cout<<tot;
}
content_copyCOPY

https://www.acmicpc.net/submit/1117/74789328