QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#578043 | #9296. Golden Spirit | shift | AC ✓ | 3ms | 3684kb | C++20 | 4.7kb | 2024-09-20 16:09:47 | 2024-09-20 16:09:49 |
Judging History
answer
// #pragma once
// C
#include <cassert>
#include <cctype>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <csetjmp>
#include <cstdarg>
#include <cstddef>
#include <cstdlib>
#include <cstdint>
// C++
#include <bitset>
#include <complex>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iterator>
#include <limits>
#include <memory>
#include <new>
#include <numeric>
#include <typeinfo>
#include <utility>
#include <array>
#include <atomic>
#include <initializer_list>
#include <ratio>
#include <scoped_allocator>
#include <tuple>
#include <typeindex>
#include <type_traits>
#if _HAS_CXX17
#include <any>
// #include <execution>
#include <optional>
#include <variant>
#include <string_view>
#endif
#if _HAS_CXX20
#include <bit>
#include <compare>
#include <concepts>
#include <numbers>
#include <ranges>
#include <span>
#include <source_location>
#include <version>
#endif
#if _HAS_CXX23
#include <expected>
#include <stdatomic.h>
#if __cpp_impl_coroutine
#include <coroutine>
#endif
#endif
// C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cuchar>
// C++
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <shared_mutex>
#if _HAS_CXX17
#include <any>
#include <charconv>
// #include <execution>
#include <filesystem>
#include <optional>
#include <memory_resource>
#include <variant>
#endif
#if _HAS_CXX20
#include <barrier>
#include <bit>
#include <compare>
#include <concepts>
#include <format>
#include <latch>
#include <numbers>
#include <ranges>
#include <span>
#include <stop_token>
#include <semaphore>
#include <source_location>
#include <syncstream>
#include <version>
#endif
#if _HAS_CXX23
#include <expected>
#include <spanstream>
#if __has_include(<stacktrace>)
#include <stacktrace>
#endif
#include <stdatomic.h>
#include <stdfloat>
#endif
using i64 = long long;
using u64 = unsigned long long;
// https://github.com/Heltion/debug.h/blob/main/debug.h
template <class T, size_t size = std::tuple_size<T>::value> std::string to_debug(T, std::string s = "") requires(not std::ranges::range<T>);
std::string to_debug(auto x) requires requires(std::ostream& os) { os << x; } { return static_cast<std::ostringstream>(std::ostringstream() << x).str(); }
std::string to_debug(std::ranges::range auto x, std::string s = "") requires(not std::is_same_v<decltype(x), std::string>) {
for (auto xi : x) { s += ", " + to_debug(xi); }
return "[" + s.substr(s.empty() ? 0 : 2) + "]";
}
template <class T, size_t size> std::string to_debug(T x, std::string s) requires(not std::ranges::range<T>) {
[&]<size_t... I>(std::index_sequence<I...>) { ((s += ", " + to_debug(get<I>(x))), ...); }(std::make_index_sequence<size>());
return "(" + s.substr(s.empty() ? 0 : 2) + ")";
}
#define debug(...) std::cerr << __FILE__ ":" << __LINE__ << ": (" #__VA_ARGS__ ") = " << to_debug(std::tuple(__VA_ARGS__)) << "\n"
void solve() {
i64 n, x, t;
std::cin >> n >> x >> t;
std::cout << 4 * t * n + std::max(0LL, std::min(x - 2 * t * (n - 1), std::max(0LL, x - 2 * n * t) + t)) << '\n';
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int T = 1;
std::cin >> T;
while(T -- ) {
solve();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3620kb
input:
3 2 2 2 3 1 10 11 45 14
output:
16 120 616
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
10000 3050395 689380 200550 5885929 822329 269033 6682339 28476 346976 9571342 934182 89292 9928491 668975 401621 6524373 173981 202472 5331629 482403 456644 9661686 231207 298636 5454412 961564 632648 5186684 9125 590489 8036028 738212 913802 1211903 553317 790831 6044436 222947 254859 2202128 6558...
output:
2447026869000 6334036546628 9274445027456 3418577079456 15949961935644 5284011400224 9738625572304 11541309041184 13802891371904 12250719393904 29373353833824 3833641845572 6161915658096 2696646672192 889295255040 9043948257972 6143939454024 1326337246416 23705160125976 15247208366860 5472590146452 ...
result:
ok 10000 lines
Test #3:
score: 0
Accepted
time: 3ms
memory: 3644kb
input:
10000 594723114 407981328 896391000 649329149 783500515 408569329 237642390 590800940 644908695 992988926 426982043 960904958 921097575 232371931 795650931 710943322 738763456 432346937 845005795 879271899 469762267 158882486 766347309 285249 748274327 755325962 863110734 233975557 855627552 5150046...
output:
2132417787526296000 1061183898828284084 613030574446324200 3816671928929980432 2931488572362369300 1229496670589218856 1587807351549349060 181284280996056 2583374414441304072 48199399000633792 1052133454101117168 1309226869082755812 1724129411130706192 263762517467447900 3058789427644673032 12923964...
result:
ok 10000 lines
Test #4:
score: 0
Accepted
time: 3ms
memory: 3632kb
input:
10000 99016579 761786640 160 71737493 984241598 977 27826041 277148547 990 88973784 901941720 46 46441172 371196151 280 92324360 30679269 825 93045364 702608274 160 68873875 179647153 698 87041665 911660065 344 55223138 469037823 897 71831310 223505225 199 19495836 830028859 673 23181306 539965245 6...
output:
63370610560 280350122644 110191122360 16371176256 52014112640 304670388000 59549032960 192295859000 119769331040 198140619144 57177722760 52482790512 64258580232 300299282316 22788201656 79983599820 112947271032 37014643596 274156860472 103941031356 126017484800 70121503680 327844796928 35906135200 ...
result:
ok 10000 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
10000 66760195 117 474771046 65866628 676 178764261 49851679 885 470017475 68723625 102 68527714 10058185 150 815303250 73342318 776 949048735 25245474 143 290104428 38614158 174 356262905 53314496 174 995266448 39152112 531 211490392 93320980 618 733546580 29089481 103 681144099 89083811 703 960131...
output:
126783230445255880 47098396315927632 93724641152362100 18837891676173000 32801883678405000 278421736479470920 29295295177435488 55027168412835960 212248516243320832 33121182058031616 273821142884993600 79256513304490476 342128534824408152 84063958443535752 78333082607224452 128584239947604528 220050...
result:
ok 10000 lines
Test #6:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
1 1 200 100
output:
500
result:
ok single line: '500'
Test #7:
score: 0
Accepted
time: 3ms
memory: 3552kb
input:
9399 918021225 50322501 225774516 255859109 200766743 603866243 1000000000 688731042 755348685 638312045 603342924 877161016 448676333 961910346 407335634 336679436 412312398 840366167 374786955 483513655 254293911 848934965 46931548 610288490 822040234 503740975 25029353 698340829 969918637 3759813...
output:
829063191008408400 618018715556629948 3021394740000000000 2239609767668950880 731047434253400488 1131736028556167248 381224162314924020 2072380951592211400 82300540787954408 1050252471483070176 6090546536837232 1403426176394799200 686861095065499440 31417084644541080 716966040629994580 7175645738792...
result:
ok 9399 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
810 1 1 1 1 1 2 1 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1 8 1 1 9 1 2 1 1 2 2 1 2 3 1 2 4 1 2 5 1 2 6 1 2 7 1 2 8 1 2 9 1 3 1 1 3 2 1 3 3 1 3 4 1 3 5 1 3 6 1 3 7 1 3 8 1 3 9 1 4 1 1 4 2 1 4 3 1 4 4 1 4 5 1 4 6 1 4 7 1 4 8 1 4 9 1 5 1 1 5 2 1 5 3 1 5 4 1 5 5 1 5 6 1 5 7 1 5 8 1 5 9 1 6 1 1 6 2 1 6 3 1 6 4 1 ...
output:
5 9 13 17 21 25 29 33 37 5 10 14 18 22 26 30 34 38 6 10 15 19 23 27 31 35 39 7 10 15 20 24 28 32 36 40 8 11 15 20 25 29 33 37 41 9 12 15 20 25 30 34 38 42 10 13 16 20 25 30 35 39 43 11 14 17 20 25 30 35 40 44 12 15 18 21 25 30 35 40 45 5 9 13 17 21 25 29 33 37 5 10 14 18 22 26 30 34 38 6 10 15 19 23...
result:
ok 810 lines
Extra Test:
score: 0
Extra Test Passed