답안 #1031791

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1031791 2024-07-23T07:15:09 Z stdfloat 이상한 기계 (APIO19_strange_device) C++17
5 / 100
554 ms 116676 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

    int n;
    ll A, B;
    cin >> n >> A >> B;

    ll L = (A & 1 ? A : A >> 1);
    map<ll, int> m;
    while (n--) {
        ll l, r;
        cin >> l >> r;

        if (L <= r - l + 1) {
            m[0]++; m[L]--;
            continue;
        }

        m[l % L]++; m[r % L + 1]--;

        if (l % L > r % L) {
            m[0]++; m[L]--;
        }
    }

    vector<pair<ll, int>> v;
    for (auto i : m) v.push_back(i);

    int sm = 0;
    ll ans = 0;
    for (int i = 0; i + 1 < (int)v.size(); i++) {
        sm += v[i].second;
        ans += !!sm * (v[i + 1].first - v[i].first);
    }

    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 471 ms 79560 KB Output is correct
3 Correct 520 ms 79524 KB Output is correct
4 Correct 554 ms 116664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 471 ms 79560 KB Output is correct
3 Correct 520 ms 79524 KB Output is correct
4 Correct 554 ms 116664 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Incorrect 447 ms 116676 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 471 ms 79560 KB Output is correct
3 Correct 520 ms 79524 KB Output is correct
4 Correct 554 ms 116664 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 42 ms 6752 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 34 ms 1196 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -