Task: | Lista |
Sender: | cowperso |
Submission time: | 2022-01-22 14:38:35 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 39 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 13 |
#2 | ACCEPTED | 26 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#2 | ACCEPTED | 0.01 s | 2, 3 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
#4 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#5 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#6 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#7 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#8 | ACCEPTED | 0.01 s | 3 | details |
#9 | TIME LIMIT EXCEEDED | -- | 3 | details |
#10 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:18:33: warning: converting to 'std::stringstream {aka std::__cxx11::basic_stringstream<char>}' from initializer list would use explicit constructor 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Alloc>::basic_stringstream(std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::ios_base::openmode = std::_Ios_Openmode]' std::stringstream tulokset = {}; ^ input/code.cpp:18:33: note: in C++11 and above a default constructor can be explicit input/code.cpp:32:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (rivi[j] != '0' + num % 10) {
Code
#include <iostream> #include <sstream> uint32_t mypow(uint32_t n, uint32_t p) { uint32_t res = 1; while (p--) res *= n; return res; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); uint32_t n; std::cin >> n; uint32_t ed = 0; std::stringstream tulokset = {}; for (uint32_t i = 0; i < n; ++i) { std::string rivi; std::cin >> rivi; uint32_t l = mypow(10, rivi.size() - 1); bool outdone = false; for (uint32_t tst = std::max(ed + 1, l); tst < 10 * l; ++tst) { uint32_t num = tst; bool done = true; for (uint32_t j = rivi.size() - 1; j < rivi.size(); --j) { if (rivi[j] == '?') { num /= 10; continue; } if (rivi[j] != '0' + num % 10) { done = false; break; } num /= 10; } if (done) { ed = tst; tulokset << tst << '\n'; outdone = true; break; } } if (!outdone) { std::cout << "IMPOSSIBLE\n"; return 0; } } std::cout << tulokset.str(); }
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
100 ?? ?? ?? ?? ... |
correct output |
---|
10 11 12 13 20 ... |
user output |
---|
10 11 12 13 20 ... Truncated |
Test 2
Group: 2, 3
Verdict: ACCEPTED
input |
---|
1000 8?? ??8? ???? ???? ... |
correct output |
---|
800 1080 1081 1082 1083 ... |
user output |
---|
800 1080 1081 1082 1083 ... Truncated |
Test 3
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 ?????? ?????9? ??98??? ?????5? ... |
correct output |
---|
100000 1000090 1098000 1098050 4100001 ... |
user output |
---|
(empty) |
Test 4
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
100 ? ? ? ? ... |
correct output |
---|
1 2 3 4 5 ... |
user output |
---|
1 2 3 4 5 ... Truncated |
Test 5
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
2 ??? ?? |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 6
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
3 123 ??? 124 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 7
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
5 1?? ??? 2?? ??? ... |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 8
Group: 3
Verdict: ACCEPTED
input |
---|
1000 ????????? ????????? ????????? ????????? ... |
correct output |
---|
100000000 100000001 100000002 100000003 100000004 ... |
user output |
---|
100000000 100000001 100000002 100000003 100000004 ... Truncated |
Test 9
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
900 ???000000 ???000000 ???000000 ???000000 ... |
correct output |
---|
100000000 101000000 102000000 103000000 104000000 ... |
user output |
---|
(empty) |
Test 10
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 ???1????? ???0????? ???1????? ???0????? ... |
correct output |
---|
100100000 101000000 101100000 102000000 102100000 ... |
user output |
---|
(empty) |