제출 #1275032

#제출 시각아이디문제언어결과실행 시간메모리
1275032hssaan_arifRoom Temperature (JOI24_ho_t1)C++20
0 / 100
1 ms568 KiB
// #include <me>
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define pb push_back
#define int long long

const int N = 3e5 + 5, M = 1e9 + 7, LG = 20;

int n , T , x , y;

void solve(){
    cin >> n >> T;
    cin >> x >> y;
    int ans = 1e18;
    int a = x%T , b = y%T;
    ans = min(ans , (a + b) - 2 * ((a + b)/2));
    a = x%T - T , b = y%T;
    ans = min(ans , (a + b) - 2 * ((a + b)/2));
    a = x%T , b = y%T - T;
    ans = min(ans , (a + b) - 2 * ((a + b)/2));
    a = x%T - T , b = y%T - T;
    ans = min(ans , (a + b) - 2 * ((a + b)/2));
    cout << ans << endl;

}

signed main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int ts = 1;
    // cin >> ts;
    while(ts--){
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...