답안 #1117957

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1117957 2024-11-24T13:06:32 Z blackslex Inspections (NOI23_inspections) C++17
29 / 100
729 ms 1048576 KB
#include<bits/stdc++.h>

using namespace std;

int n, m, q, x;

int main() {
    scanf("%d %d %d", &n, &m, &q);
    vector<int> a, l(m), r(m), lst(n + 5, -1), cnt(n * m + 5);
    for (int i = 0; i < m; i++) {
        scanf("%d %d", &l[i], &r[i]);
        for (int j = l[i]; j <= r[i]; j++) a.emplace_back(j);
    }
    for (int i = 0; i < a.size(); i++) {
        if (lst[a[i]] != -1) cnt[i - lst[a[i]] - 1]++;
        lst[a[i]] = i;
    }
    for (int i = a.size() - 2; i >= 0; i--) cnt[i] += cnt[i + 1];
    while (q--) {
        scanf("%d", &x);
        printf("%d ", (x >= a.size() ? 0 : cnt[x]));
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (int i = 0; i < a.size(); i++) {
      |                     ~~^~~~~~~~~~
Main.cpp:21:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         printf("%d ", (x >= a.size() ? 0 : cnt[x]));
      |                        ~~^~~~~~~~~~~
Main.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d %d %d", &n, &m, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d %d", &l[i], &r[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 592 KB Output is correct
6 Correct 1 ms 592 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 592 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 592 KB Output is correct
6 Correct 1 ms 592 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 592 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 37 ms 26556 KB Output is correct
14 Correct 29 ms 18292 KB Output is correct
15 Correct 45 ms 26556 KB Output is correct
16 Correct 48 ms 26556 KB Output is correct
17 Correct 30 ms 18620 KB Output is correct
18 Correct 42 ms 26556 KB Output is correct
19 Correct 34 ms 26300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 816 KB Output is correct
3 Correct 43 ms 26556 KB Output is correct
4 Runtime error 729 ms 1048576 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 592 KB Output is correct
6 Correct 1 ms 592 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 592 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 37 ms 26556 KB Output is correct
14 Correct 29 ms 18292 KB Output is correct
15 Correct 45 ms 26556 KB Output is correct
16 Correct 48 ms 26556 KB Output is correct
17 Correct 30 ms 18620 KB Output is correct
18 Correct 42 ms 26556 KB Output is correct
19 Correct 34 ms 26300 KB Output is correct
20 Runtime error 620 ms 1048576 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 592 KB Output is correct
6 Correct 1 ms 592 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 592 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 37 ms 26556 KB Output is correct
14 Correct 29 ms 18292 KB Output is correct
15 Correct 45 ms 26556 KB Output is correct
16 Correct 48 ms 26556 KB Output is correct
17 Correct 30 ms 18620 KB Output is correct
18 Correct 42 ms 26556 KB Output is correct
19 Correct 34 ms 26300 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 816 KB Output is correct
22 Correct 43 ms 26556 KB Output is correct
23 Runtime error 729 ms 1048576 KB Execution killed with signal 9
24 Halted 0 ms 0 KB -