답안 #1112951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112951 2024-11-15T09:59:28 Z Aviansh Inspections (NOI23_inspections) C++17
29 / 100
1777 ms 1048576 KB
#include <bits/stdc++.h>

using namespace std;

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m,q;
    cin >> n >> m >> q;
    vector<int>arr;
    for(int i = 0;i<m;i++){
        int a,b;
        cin >> a >> b;
        for(int j = a;j<=b;j++){
            arr.push_back(j);
        }
    }
    vector<int>pos[n];
    for(int i = 0;i<arr.size();i++){
        pos[arr[i]-1].push_back(i);
    }
    vector<int>diff;
    for(int i = 0;i<n;i++){
        for(int j = 1;j<pos[i].size();j++){
            diff.push_back(pos[i][j]-pos[i][j-1]);
        }
    }
    sort(diff.begin(),diff.end());
    while(q--){
        int p;
        cin >> p;
        cout << (diff.size() - (upper_bound(diff.begin(),diff.end(),p)-diff.begin())) << " ";
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:19:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i = 0;i<arr.size();i++){
      |                   ~^~~~~~~~~~~
Main.cpp:24:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(int j = 1;j<pos[i].size();j++){
      |                       ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 2 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 3 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 2 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 2 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 3 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 2 ms 336 KB Output is correct
13 Correct 129 ms 28056 KB Output is correct
14 Correct 26 ms 2912 KB Output is correct
15 Correct 152 ms 34756 KB Output is correct
16 Correct 128 ms 31816 KB Output is correct
17 Correct 35 ms 4428 KB Output is correct
18 Correct 161 ms 31672 KB Output is correct
19 Correct 132 ms 25024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 164 ms 31416 KB Output is correct
4 Runtime error 1233 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 2 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 3 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 2 ms 336 KB Output is correct
13 Correct 129 ms 28056 KB Output is correct
14 Correct 26 ms 2912 KB Output is correct
15 Correct 152 ms 34756 KB Output is correct
16 Correct 128 ms 31816 KB Output is correct
17 Correct 35 ms 4428 KB Output is correct
18 Correct 161 ms 31672 KB Output is correct
19 Correct 132 ms 25024 KB Output is correct
20 Runtime error 1777 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 2 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 3 ms 848 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 2 ms 336 KB Output is correct
13 Correct 129 ms 28056 KB Output is correct
14 Correct 26 ms 2912 KB Output is correct
15 Correct 152 ms 34756 KB Output is correct
16 Correct 128 ms 31816 KB Output is correct
17 Correct 35 ms 4428 KB Output is correct
18 Correct 161 ms 31672 KB Output is correct
19 Correct 132 ms 25024 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 2 ms 848 KB Output is correct
22 Correct 164 ms 31416 KB Output is correct
23 Runtime error 1233 ms 1048576 KB Execution killed with signal 9
24 Halted 0 ms 0 KB -