Submission #1117956

# Submission time Handle Problem Language Result Execution time Memory
1117956 2024-11-24T13:05:21 Z blackslex Inspections (NOI23_inspections) C++17
0 / 100
581 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 ", 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: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);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Runtime error 2 ms 1104 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Runtime error 2 ms 1104 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 50 ms 26728 KB Output is correct
4 Runtime error 581 ms 1048576 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Runtime error 2 ms 1104 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Runtime error 2 ms 1104 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -