답안 #252453

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
252453 2020-07-25T15:37:37 Z Badrangiikh 이상한 기계 (APIO19_strange_device) C++14
10 / 100
2250 ms 32604 KB
#include<bits/stdc++.h>
#include <deque> 
#include <cmath>
using namespace std;
 
#define ll long long 
 
/*freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);*/
 
long long x , y , z , i , j , n , m , k , s1 , s2 , s3 , s4 , s5 , s6 , mod , l , r , t , maxx , minn , sx , so , sum , mid , ans , puk , par , chi , sz , choc1 , choc2 , len , depth ;
double u , v , w , x1 , x2 , x3 , x4 , z1 , z2 , z3 , h , huh ;
string s ;
string q ;
string p ;
string sq [ 1045 ] ;
char ch ;
char cha ;
vector < long long > vc ;
vector < long long > cv ;
vector < long long > vv ;
vector < long long > cc ;
long long dp [ 200045 ] [ 6 ] ;
long long tmp [ 300045 ] ;
pair < long long , long long > aa [ 300045 ] ;
long long a [ 300045 ] ;
long long b [ 200045 ] ;
long long c [ 200045 ] ;
map < long long , long long > mp ;

int main() {
    cin >> n >> x >> y ;
    z = __gcd ( x , y + 1 ) ;
    k = ( x / z ) * y ;
    x = 0 ;
    for ( i = 1 ; i <= n ; i ++ ) {
        cin >> l >> r ;
        if ( r - l + 1 >= k ) {
            x ++ ;
            aa [ x ] . first = 0 ;
            aa [ x ] . second = k - 1 ;
        }
        l %= k ;
        r %= k ;
        if ( l <= r ) {
            x ++ ;
            aa [ x ] . first = l ;
            aa [ x ] . second = r ;
        }
        else {
            x ++ ;
            aa [ x ] . first = l ;
            aa [ x ] . second = k - 1 ;
            x ++ ;
            aa [ x ] . first = 0 ;
            aa [ x ] . second = r ;
        }
    }
    sort ( aa + 1 , aa + x + 1 ) ;
    r = aa [ 1 ] . second ;
    ans = k - aa [ 1 ] . first ; 
    for ( i = 2 ; i <= x ; i ++ ) {
        if ( aa [ i ] . first > r + 1 ) {
            ans -= ( aa [ i ] . first - r - 1 ) ;
        }
        r = aa [ i ] . second ;
    }
    ans -= ( k - 1 - aa [ x ] . second ) ;
    printf ( "%lld" , ans ) ;
}    
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 28 ms 888 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Incorrect 0 ms 384 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2165 ms 16276 KB Output is correct
3 Correct 2140 ms 16476 KB Output is correct
4 Correct 2120 ms 16276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2165 ms 16276 KB Output is correct
3 Correct 2140 ms 16476 KB Output is correct
4 Correct 2120 ms 16276 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2124 ms 16344 KB Output is correct
7 Correct 2250 ms 16436 KB Output is correct
8 Correct 2120 ms 16328 KB Output is correct
9 Correct 2152 ms 16184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2165 ms 16276 KB Output is correct
3 Correct 2140 ms 16476 KB Output is correct
4 Correct 2120 ms 16276 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 212 ms 2356 KB Output is correct
7 Correct 214 ms 2284 KB Output is correct
8 Correct 210 ms 2296 KB Output is correct
9 Correct 227 ms 2272 KB Output is correct
10 Correct 244 ms 2276 KB Output is correct
11 Correct 213 ms 2424 KB Output is correct
12 Correct 209 ms 2168 KB Output is correct
13 Correct 215 ms 2232 KB Output is correct
14 Correct 219 ms 5684 KB Output is correct
15 Incorrect 227 ms 5624 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 218 ms 2168 KB Output is correct
3 Correct 225 ms 5644 KB Output is correct
4 Correct 2232 ms 32604 KB Output is correct
5 Correct 219 ms 5672 KB Output is correct
6 Correct 223 ms 5600 KB Output is correct
7 Correct 217 ms 5624 KB Output is correct
8 Correct 222 ms 5624 KB Output is correct
9 Correct 217 ms 5624 KB Output is correct
10 Correct 217 ms 5752 KB Output is correct
11 Correct 215 ms 5624 KB Output is correct
12 Correct 209 ms 5624 KB Output is correct
13 Correct 223 ms 5624 KB Output is correct
14 Incorrect 2193 ms 32476 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 28 ms 888 KB Output isn't correct
3 Halted 0 ms 0 KB -