結果
問題 | No.1708 Quality of Contest |
ユーザー | atjh16 |
提出日時 | 2021-10-17 11:31:55 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,218 bytes |
コンパイル時間 | 2,529 ms |
コンパイル使用メモリ | 213,496 KB |
実行使用メモリ | 20,484 KB |
最終ジャッジ日時 | 2024-09-17 19:38:55 |
合計ジャッジ時間 | 10,760 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
10,380 KB |
testcase_01 | AC | 4 ms
10,056 KB |
testcase_02 | AC | 5 ms
10,584 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | AC | 5 ms
9,288 KB |
testcase_09 | AC | 292 ms
20,484 KB |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/vector:64, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/functional:62, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:71, from main.cpp:1: In member function 'void std::vector<_Tp, _Alloc>::_M_erase_at_end(pointer) [with _Tp = long long int; _Alloc = std::allocator<long long int>]', inlined from 'void std::vector<_Tp, _Alloc>::clear() [with _Tp = long long int; _Alloc = std::allocator<long long int>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_vector.h:1601:24, inlined from 'int main()' at main.cpp:76:16: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_vector.h:1930:43: warning: 'q2' may be used uninitialized [-Wmaybe-uninitialized] 1930 | if (size_type __n = this->_M_impl._M_finish - __pos) | ~~~~~~~~~~~~~~^~~~~~~~~ main.cpp: In function 'int main()': main.cpp:45:31: note: 'q2' was declared here 45 | int w = 1, y = 0, q1, q2; | ^~
ソースコード
#include <bits/stdc++.h> using namespace std; int n, k; long long m, x, s, t, z = 0; vector<long long> a[200000]; long long c[200000], d[200001]; priority_queue<pair<long long, int>> Q1, Q2; int main() { cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> s >> t; t--; a[t].push_back(s); } for (int i = 0; i < m; i++) { sort(a[i].begin(), a[i].end()); Q2.push({ a[i].back(), i }); a[i].pop_back(); } cin >> k; for (int i = 0; i < k; i++) cin >> c[i]; sort(c, c + k); int j = 0, u = k; for (int i = 0; i < k; i++) { while (j <= c[i]) { d[j] = u; j++; } u--; } long long p1 = 0, p2 = 0, z1 = -1, z2 = -1; int w = 1, y = 0, q1, q2; while (!Q1.empty() || !Q2.empty()) { if (!Q1.empty()) { p1 = Q1.top().first; q1 = Q1.top().second; Q1.pop(); z1 = p1; } if (!Q2.empty()) { p2 = Q2.top().first; q2 = Q2.top().second; Q2.pop(); z2 = p2 + x; } if (z1 >= z2) { z += z1 * d[w]; z1 = 0; if(z2 > 0) Q2.push({ p2, q2 }); } else { z += z2 * d[w]; y++; z2 = 0; for(auto pq : a[q2]){ Q1.push({ pq, q2 }); a[q2].clear(); } if(z1 > 0) Q1.push({ p1, q1 }); } w++; } cout << z << endl; }