답안 #267731

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
267731 2020-08-16T05:50:43 Z kkm0476 이상한 기계 (APIO19_strange_device) C++
10 / 100
883 ms 524292 KB
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long lint;

lint n, A, B;
vector<pair<lint, lint> > v;

int main() {
    scanf("%lld %lld %lld", &n, &A, &B);
    
    for(lint i = 0; i < n; i++) {
        lint l, r;
        scanf("%lld %lld", &l, &r);
        for(lint t = l; t <= r; t++) {
            lint x = (t + (t / B)) % A;
            lint y = t % B;
            v.push_back({x, y});
        }
    }
    
    lint ret = 0;
    sort(v.begin(), v.end());
    for(lint i = 0; i < v.size(); i++) {
        if(i == 0)
            ret++;
        else if(v[i].first != v[i - 1].first || v[i].second != v[i - 1].second)
                ret++;
    }
    
    printf("%lld", ret);
    
    return 0;
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:28:23: warning: comparison of integer expressions of different signedness: 'lint' {aka 'long long int'} and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(lint i = 0; i < v.size(); i++) {
      |                     ~~^~~~~~~~~~
strange_device.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |     scanf("%lld %lld %lld", &n, &A, &B);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strange_device.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |         scanf("%lld %lld", &l, &r);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 30 ms 4624 KB Output is correct
3 Correct 47 ms 9068 KB Output is correct
4 Correct 2 ms 768 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 9 ms 1528 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 46 ms 8684 KB Output is correct
16 Correct 22 ms 2932 KB Output is correct
17 Correct 55 ms 3308 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Runtime error 669 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 90 ms 16864 KB Output is correct
3 Correct 104 ms 16828 KB Output is correct
4 Correct 97 ms 16872 KB Output is correct
5 Runtime error 669 ms 524292 KB Execution killed with signal 9
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 539 ms 16848 KB Output is correct
3 Runtime error 841 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 539 ms 16848 KB Output is correct
3 Runtime error 841 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 539 ms 16848 KB Output is correct
3 Runtime error 841 ms 524292 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Runtime error 883 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 30 ms 4624 KB Output is correct
3 Correct 47 ms 9068 KB Output is correct
4 Correct 2 ms 768 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 9 ms 1528 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 46 ms 8684 KB Output is correct
16 Correct 22 ms 2932 KB Output is correct
17 Correct 55 ms 3308 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Runtime error 669 ms 524292 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -