| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1336497 | mamabear | Data Centers (EGOI22_datacenters) | C++20 | 260 ms | 1988 KiB |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, s;
if (!(cin >> n >> s)) return 0;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end(), greater<int>());
vector<int> temp(n);
for (int i = 0; i < s; i++) {
int m, c;
cin >> m >> c;
for (int j = 0; j < c; j++) {
a[j] -= m;
}
int p1 = 0;
int p2 = c;
int p_temp = 0;
while (p1 < c && p2 < n) {
if (a[p1] >= a[p2]) {
temp[p_temp++] = a[p1++];
} else {
temp[p_temp++] = a[p2++];
}
}
while (p1 < c) {
temp[p_temp++] = a[p1++];
}
while (p2 < n) {
temp[p_temp++] = a[p2++];
}
a.swap(temp);
}
for (int i = 0; i < n; i++) {
cout << a[i] << (i == n - 1 ? "" : " ");
}
cout << "\n";
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
