Codeforces Round #503 (by SIS, Div. 2)

Posted kisekipurin2019

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #503 (by SIS, Div. 2)相关的知识,希望对你有一定的参考价值。

A - New Building for SIS

题意:英语阅读,ab之间都有通道。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void test_case() {
    int n, h, a, b, q;
    scanf("%d%d%d%d%d", &n, &h, &a, &b, &q);
    while(q--) {
        int t1, h1, t2, h2;
        scanf("%d%d%d%d", &t1, &h1, &t2, &h2);
        if(t1 == t2)
            printf("%d
", abs(h1 - h2));
        else if(a <= h1 && h1 <= b || a <= h2 && h2 <= b)
            printf("%d
", abs(h1 - h2) + abs(t1 - t2));
        else
            printf("%d
", min(abs(h1 - a) + abs(h2 - a), abs(h1 - b) + abs(h2 - b)) + abs(t1 - t2));
    }
}

int main() {
#ifdef KisekiPurin
    freopen("KisekiPurin.in", "r", stdin);
#endif // KisekiPurin
    int t = 1;
    for(int ti = 1; ti <= t; ++ti) {
        //printf("Case #%d: ", ti);
        test_case();
    }
}

以上是关于Codeforces Round #503 (by SIS, Div. 2)的主要内容,如果未能解决你的问题,请参考以下文章

Codeforces Round #503 (by SIS, Div. 2) C. Elections

Codeforces Round #503 (by SIS, Div. 2)

Codeforces Round #503 (by SIS, Div. 2)-C. Elections

Codeforces Round #503 (by SIS, Div. 2) Partial Solution

Codeforces Round #503 (by SIS, Div. 2) C. Elections

Codeforces Round #503 (by SIS, Div. 2) D. The hat