Task: | Uolevin kalansaalis |
Sender: | kitchent |
Submission time: | 2023-11-04 15:39:41 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.01 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#3 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#4 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#5 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#6 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#7 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#8 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#9 | ACCEPTED | 0.00 s | 1, 2 | details |
#10 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#11 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#12 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#13 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#14 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#15 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#16 | WRONG ANSWER | 0.02 s | 2 | details |
#17 | WRONG ANSWER | 0.02 s | 2 | details |
#18 | WRONG ANSWER | 0.02 s | 2 | details |
#19 | WRONG ANSWER | 0.02 s | 2 | details |
#20 | WRONG ANSWER | 0.02 s | 2 | details |
#21 | WRONG ANSWER | 0.02 s | 2 | details |
#22 | WRONG ANSWER | 0.02 s | 2 | details |
#23 | WRONG ANSWER | 0.02 s | 2 | details |
#24 | WRONG ANSWER | 0.02 s | 2 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:19:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 19 | for (int i=0; i<s.size(); i++) { | ~^~~~~~~~~
Code
#include <iostream> #include <bits/stdc++.h> #define all(arr) arr.begin(), arr.end() using namespace std; string s; int curr = 0; const int N = 500003; char res[N]; int p[N]; int di; int main() { ios_base::sync_with_stdio(false); cin.tie(0); getline(cin, s); for (int i=0; i<s.size(); i++) { res[i] = s[i]; p[i] = i+1; } p[s.size()-1] = -1; int bound = s.size(); int curr2; while (p[curr] >= 0) { if (res[curr] >= '1' && res[curr] <= '9') { di = res[curr] - '0'; res[curr] = res[p[curr]]; int broken = p[curr]; curr2 = p[p[curr]]; if (di > 1) p[curr] = bound; for (int d=1; d<di; d++) { res[bound] = res[curr2]; curr2 = p[curr2]; if (d < di - 1) p[bound] = bound + 1; else p[bound] = broken; bound++; } } else { curr = p[curr]; } } curr = 0; while (p[curr] >= 0) { cout << res[curr]; curr = p[curr]; } cout << res[curr] << "\n"; return 0; }