답안 #467394

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
467394 2021-08-22T22:18:23 Z SirCovidThe19th 이상한 기계 (APIO19_strange_device) C++17
35 / 100
2130 ms 100204 KB
#include <bits/stdc++.h>
using namespace std; 

#define ll long long

int main(){
    int n; ll a, b; cin >> n >> a >> b; 
    ll p = a / __gcd(a, b + 1) * b; map<ll, int> d;
    for (int i = 0; i < n; i++){
        ll l, r; cin >> l >> r;
        if (r - l + 1 >= p){ d[0]++, d[p]--; continue; }
        l %= p; r %= p;
        if (l <= r) d[l]++, d[r + 1]--;
        else d[0]++, d[r + 1]--, d[l]++, d[p]--;
    }
    ll cnt = 0, pre, ans = 0;
    for (auto &val : d){
        if (cnt) ans += val.first - pre;
        cnt += val.second; pre = val.first;
    }
    cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 17 ms 1296 KB Output is correct
3 Correct 17 ms 1216 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 296 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 ms 292 KB Output is correct
11 Correct 0 ms 296 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 17 ms 1244 KB Output is correct
17 Correct 177 ms 10220 KB Output is correct
18 Incorrect 1 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 220 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 312 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1063 ms 25392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1804 ms 100052 KB Output is correct
3 Correct 1831 ms 100096 KB Output is correct
4 Correct 2041 ms 99972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1804 ms 100052 KB Output is correct
3 Correct 1831 ms 100096 KB Output is correct
4 Correct 2041 ms 99972 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2130 ms 100152 KB Output is correct
7 Correct 1836 ms 100072 KB Output is correct
8 Correct 1847 ms 100040 KB Output is correct
9 Correct 1915 ms 100028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1804 ms 100052 KB Output is correct
3 Correct 1831 ms 100096 KB Output is correct
4 Correct 2041 ms 99972 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 199 ms 10276 KB Output is correct
7 Correct 171 ms 10180 KB Output is correct
8 Correct 180 ms 10152 KB Output is correct
9 Correct 216 ms 10260 KB Output is correct
10 Correct 170 ms 10268 KB Output is correct
11 Correct 170 ms 10276 KB Output is correct
12 Correct 172 ms 10168 KB Output is correct
13 Correct 185 ms 10252 KB Output is correct
14 Correct 172 ms 10240 KB Output is correct
15 Correct 181 ms 10148 KB Output is correct
16 Correct 182 ms 10176 KB Output is correct
17 Correct 184 ms 10388 KB Output is correct
18 Correct 1938 ms 100084 KB Output is correct
19 Correct 2066 ms 100108 KB Output is correct
20 Correct 1925 ms 100204 KB Output is correct
21 Correct 175 ms 10148 KB Output is correct
22 Correct 180 ms 10212 KB Output is correct
23 Correct 491 ms 12812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 180 ms 10212 KB Output is correct
3 Correct 182 ms 10240 KB Output is correct
4 Correct 1942 ms 100124 KB Output is correct
5 Correct 181 ms 10196 KB Output is correct
6 Correct 181 ms 10244 KB Output is correct
7 Correct 221 ms 10308 KB Output is correct
8 Correct 181 ms 10176 KB Output is correct
9 Correct 181 ms 10224 KB Output is correct
10 Correct 177 ms 10272 KB Output is correct
11 Correct 175 ms 10180 KB Output is correct
12 Correct 177 ms 10244 KB Output is correct
13 Correct 182 ms 10196 KB Output is correct
14 Correct 1936 ms 100176 KB Output is correct
15 Correct 200 ms 10200 KB Output is correct
16 Correct 1933 ms 100104 KB Output is correct
17 Correct 1843 ms 100140 KB Output is correct
18 Incorrect 0 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 17 ms 1296 KB Output is correct
3 Correct 17 ms 1216 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 296 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 1 ms 292 KB Output is correct
11 Correct 0 ms 296 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 17 ms 1244 KB Output is correct
17 Correct 177 ms 10220 KB Output is correct
18 Incorrect 1 ms 204 KB Output isn't correct