結果
| 問題 |
No.3298 K-th Slime
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-05 16:28:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,123 bytes |
| コンパイル時間 | 2,854 ms |
| コンパイル使用メモリ | 283,720 KB |
| 実行使用メモリ | 15,936 KB |
| 最終ジャッジ日時 | 2025-10-05 16:29:00 |
| 合計ジャッジ時間 | 6,949 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | WA * 5 TLE * 1 -- * 19 |
コンパイルメッセージ
In file included from /usr/include/c++/13/bits/unique_ptr.h:42,
from /usr/include/c++/13/memory:78,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:56,
from main.cpp:1:
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’,
inlined from ‘int main()’ at main.cpp:46:21:
/usr/include/c++/13/ostream:204:25: warning: ‘v’ may be used uninitialized [-Wmaybe-uninitialized]
204 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:38:18: note: ‘v’ was declared here
38 | lint v, count = 1;
| ^
In file included from /usr/include/c++/13/map:62,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:152:
In member function ‘std::pair<std::_Rb_tree_iterator<_Val>, std::_Rb_tree_iterator<_Val> > std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::equal_range(const _Key&) [with _Key = long long int; _Val = long long int; _KeyOfValue = std::_Identity<long long int>; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]’,
inlined from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::erase(const _Key&) [with _Key = long long int; _Val = long long int; _KeyOfValue = std::_Identity<long long int>; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]’ at /usr/include/c++/13/bits/stl_tree.h:2519:49,
inlined from ‘std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]’ at /usr/include/c++/13/bits/stl_set.h:687:26,
inlined from ‘int main()’ at main.c
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using lint = long long;
using vli = vector<lint>;
int main() {
lint n, k, q;
cin >> n >> k >> q;
set<lint> s;
rep(i, n) {
lint x;
cin >> x;
s.insert(x);
}
rep(i, q) {
vli query(2);
cin >> query[0];
if (query[0] == 1) {
cin >> query[1];
s.insert(query[1]);
}
else if (query[0] == 2) {
cin >> query[1];
lint v, count = 1;
for (auto value : s) {
if (count == k) {
v = value;
break;
}
count++;
}
s.erase(v);
s.insert(v + query[1]);
}
else {
lint v, count = 1;
for (auto value : s) {
if (count == k) {
v = value;
break;
}
count++;
}
cout << v << endl;
}
}
}