답안 #832609

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832609 2023-08-21T12:31:12 Z Liudas Inspections (NOI23_inspections) C++17
0 / 100
2000 ms 26580 KB
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
int main(){
    int N, Q, M;
    cin >> N >> M >> Q;
    vector<vector<int>> arr(N);
    int day = 0;
    for(int i = 0; i < M; i ++){
        int a, b;
        cin >> a >> b;
        for(int j = a-1; j < b; j ++){
            arr[j].push_back(day++);
        }
    }
    vector<vector<pair<int, int>>> pref(N);
    for(int i = 0; i < N; i ++){
        map<int, int> vals;
        for(int j = 1; j < (int)arr[i].size(); j ++){
            vals[arr[i][j] - arr[i][j-1]]++;
        }
        for(auto[l, r] : vals){
            pref[i].push_back(make_pair(l, r));
        }
        pref[i].push_back({1e9,0});
        for(int j = ((int)pref[i].size())-2; j >= 0; j --){
            pref[i][j].second += pref[i][j+1].second;
        }
    }
    for(int i = 0; i < Q; i ++){
        int q;
        cin >> q;
        int c = 0;
        for(int j = 0; j < N; j ++){
            c += (*lower_bound(pref[j].begin(), pref[j].end(), make_pair(q+1, 0))).second;
        }
        cout << c << " ";
    }
    cout << endl;    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 2 ms 468 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 2 ms 468 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 596 KB Output is correct
3 Execution timed out 2080 ms 26580 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 2 ms 468 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 2 ms 468 KB Output isn't correct
5 Halted 0 ms 0 KB -