답안 #1115174

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1115174 2024-11-20T08:10:43 Z staszic_ojuz Fire (JOI20_ho_t5) C++17
0 / 100
1000 ms 70828 KB
#include<bits/stdc++.h>

using namespace std;
int main() {
    int n, q, t, l, p, s;
    cin >> n >> q;
    vector<int> dis;
    vector<vector<int>> fakty;
    vector<vector<pair<int, int>>> zap(2000000);
    vector<int> dod;
    for (int i = 0; i < n; i++) {
        cin >> s;
        dis.push_back(s);
    }
    for (int i = 0; i < q; i++) {
        cin >> t >> l >> p;
        zap[t - 1].push_back({l, p});
        fakty.push_back({t, l, p});
    }
    map<vector<int>, int> wyniki;
    int i = 0;
    while (wyniki.size() < fakty.size()) {
        for (int j = n - 1; j > 0; j--) {
            if (dis[j - 1] > dis[j]) {
                dis[j] = dis[j - 1];
            }
        }
        for (pair<int, int> z : zap[i]) {
            long long s = 0;
            for(int y = z.first; y <= z.second; y++) {
                s += dis[y - 1];
            }
            wyniki[{i + 1, z.first, z.second}] = s;
        }
    i += 1;
    }
    for(vector<int> i : fakty) {
        cout << wyniki[i] << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 47184 KB Output is correct
2 Incorrect 11 ms 47608 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 47184 KB Output is correct
2 Execution timed out 1072 ms 68012 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 47184 KB Output is correct
2 Execution timed out 1061 ms 70828 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1029 ms 68828 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 47184 KB Output is correct
2 Incorrect 11 ms 47608 KB Output isn't correct
3 Halted 0 ms 0 KB -