제출 #1117956

#제출 시각아이디문제언어결과실행 시간메모리
1117956blackslexInspections (NOI23_inspections)C++17
0 / 100
581 ms1048576 KiB
#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]);
    }
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...