Task: | Ruudukko |
Sender: | Totska |
Submission time: | 2021-12-09 16:56:01 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.01 s | 1 | details |
#2 | RUNTIME ERROR | 0.01 s | 1 | details |
#3 | WRONG ANSWER | 0.01 s | 1 | details |
#4 | WRONG ANSWER | 0.01 s | 1 | details |
#5 | WRONG ANSWER | 0.01 s | 1 | details |
#6 | RUNTIME ERROR | 0.77 s | 2 | details |
#7 | RUNTIME ERROR | 0.77 s | 2 | details |
#8 | WRONG ANSWER | 0.01 s | 2 | details |
#9 | RUNTIME ERROR | 0.01 s | 2 | details |
#10 | RUNTIME ERROR | 0.01 s | 2 | details |
#11 | RUNTIME ERROR | 0.81 s | 3 | details |
#12 | RUNTIME ERROR | 0.81 s | 3 | details |
#13 | RUNTIME ERROR | 0.02 s | 3 | details |
#14 | RUNTIME ERROR | 0.46 s | 3 | details |
#15 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:53:16: warning: variable 'b' set but not used [-Wunused-but-set-variable] ll b; b = ll(z); ^ input/code.cpp:115:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (ll i = 0; i < newnb.size(); i++) ~~^~~~~~~~~~~~~~ input/code.cpp:126:22: warning: unused variable 'onefound' [-Wunused-variable] bool onefound = false; ^~~~~~~~ input/code.cpp:127:22: warning: unused variable 'twofound' [-Wunused-variable] bool twofound = false; ^~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fr(x) for(ll i=0; i < x; i++) string s = ""; vector<vector<ll>> grid; ll n, ycur, xcur; vector<pair<ll, ll>> nb, newnb, tempnb; map<pair<ll, ll>, string> stored; // bool mysort(pair<pair<ll, string>, pair<ll, ll>> i, pair<pair<ll, string>, pair<ll, ll>> j) // { // return (i.first.first < j.first.first); // } ll getval(pair<ll, ll> nb) { return grid[nb.first][nb.second]; } vector<pair<ll, ll>> getnb(ll y, ll x) { vector<pair<ll, ll>> nb; if(x != n-1){ nb.push_back(pair(y, x+1)); } if(y != n-1){ nb.push_back(pair(y+1, x)); } return nb; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; fr(n) { vector<ll> row; fr(n) { char z; cin >> z; ll b; b = ll(z); row.push_back(z); } grid.push_back(row); } ycur = xcur = 0; s += grid[0][0]; while(ycur != n-1 && xcur != n-1) { nb = getnb(ycur, xcur); if(nb.size() == 1){ ycur = nb[0].first; xcur = nb[0].second; s += (char)grid[ycur][xcur]; } else if(getval(nb[0]) != getval(nb[1])){ if(getval(nb[0]) < getval(nb[1])){ ycur = nb[0].first; xcur = nb[0].second; } else{ ycur = nb[1].first; xcur = nb[1].second; s += (char) grid[ycur][xcur]; } } else{ s += (char) grid[ycur][xcur]; vector<pair<ll, ll>> eval; eval.push_back(nb[0]); eval.push_back(nb[1]); stored[nb[0]] = (char) grid[nb[0].first][nb[0].second]; stored[nb[1]] = (char) grid[nb[1].first][nb[1].second]; while(eval.size() != 0) { vector<pair<ll, ll>> values; newnb.clear(); for(auto p : eval) { tempnb = getnb(p.first, p.second); for(auto v : tempnb) { newnb.push_back(v); stored[v] = stored[p] + (char )grid[v.first][v.second]; } } eval.clear(); for (ll i = 0; i < newnb.size(); i++) { values.push_back(pair(grid[newnb[i].first][newnb[i].second], i)); } ll minval = 180; for(auto val : values) { minval = min(minval, val.first); } bool onefound = false; bool twofound = false; vector<ll> minvals; for(auto val : values) { if(val.first == minval){ minvals.push_back(val.second); } } if(minvals.size() > 1){ for(auto i : minvals) { eval.push_back(newnb[i]); } } else{ ycur = newnb[minvals[0]].first; xcur = newnb[minvals[0]].second; s += stored[pair(ycur, xcur)]; } } } } s += (char) grid[n-1][n-1]; cout << s << endl; }
Test details
Test 1
Group: 1
Verdict: RUNTIME ERROR
input |
---|
5 AAAAA AAAAA AAAAA AAAAA ... |
correct output |
---|
AAAAAAAAB |
user output |
---|
(empty) |
Test 2
Group: 1
Verdict: RUNTIME ERROR
input |
---|
5 ABABA BABAB ABABA BABAB ... |
correct output |
---|
ABABABABA |
user output |
---|
(empty) |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 WRYIU TWLKH UJMJC GRDJW ... |
correct output |
---|
WRWJMDJWK |
user output |
---|
WWJDK |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 RUEAE ZYHHW KDBPD DXREW ... |
correct output |
---|
RUEAEWDWX |
user output |
---|
RX |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 SRGYR MYDOB GNOVM SZOZK ... |
correct output |
---|
SMGNOOLTU |
user output |
---|
SMGOLU |
Test 6
Group: 2
Verdict: RUNTIME ERROR
input |
---|
100 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
user output |
---|
(empty) |
Test 7
Group: 2
Verdict: RUNTIME ERROR
input |
---|
100 ABABABABABABABABABABABABABABAB... |
correct output |
---|
ABABABABABABABABABABABABABABAB... |
user output |
---|
(empty) |
Test 8
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 FWOVNYKNMMQCNHJGUYPNEDXGVVGONC... |
correct output |
---|
FWDBDECKBHKIACOVUCJGDJOHAYIBHO... |
user output |
---|
FDBHVUCJGDDJOHAIBFJGFHPGACDTNB... Truncated |
Test 9
Group: 2
Verdict: RUNTIME ERROR
input |
---|
100 ETGCJABWKMAAEOQXWFFYMDJBMNKMQK... |
correct output |
---|
EAARGLBRLHCDHHBPABHDAJBEEBHQBE... |
user output |
---|
(empty) |
Test 10
Group: 2
Verdict: RUNTIME ERROR
input |
---|
100 GNWMLJNHSBAADUFCSGIZMWHZTVDHNR... |
correct output |
---|
GEGOFRDKBNLLEUOPOEQCEFMTKANLNC... |
user output |
---|
(empty) |
Test 11
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
user output |
---|
(empty) |
Test 12
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 ABABABABABABABABABABABABABABAB... |
correct output |
---|
ABABABABABABABABABABABABABABAB... |
user output |
---|
(empty) |
Test 13
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 HGADXTSFXYIEMDWMFIVQGHTACFUPYI... |
correct output |
---|
HGADEJOGAKPJCRAHTABRSDLAVGBFAG... |
user output |
---|
(empty) |
Test 14
Group: 3
Verdict: RUNTIME ERROR
input |
---|
500 SBLNMAZESQVGWAPZYHQJMQTNGMEZWS... |
correct output |
---|
SBLCAMDHILGIDRCIDUNMMAHFYCENOS... |
user output |
---|
(empty) |
Test 15
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 AOXYXRYFWPYWQDPWXQITLHQQUAYZAJ... |
correct output |
---|
AOJLDOAPBGEKSGCNKBUMKAJCCWCOOD... |
user output |
---|
(empty) |