Task: | Ruudukko |
Sender: | Olli |
Submission time: | 2018-01-07 20:25:45 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.06 s | 1 | details |
#2 | WRONG ANSWER | 0.05 s | 1 | details |
#3 | WRONG ANSWER | 0.04 s | 1 | details |
#4 | WRONG ANSWER | 0.04 s | 1 | details |
#5 | WRONG ANSWER | 0.05 s | 1 | details |
#6 | WRONG ANSWER | 0.05 s | 2 | details |
#7 | WRONG ANSWER | 0.04 s | 2 | details |
#8 | WRONG ANSWER | 0.04 s | 2 | details |
#9 | WRONG ANSWER | 0.04 s | 2 | details |
#10 | WRONG ANSWER | 0.04 s | 2 | details |
#11 | WRONG ANSWER | 0.28 s | 3 | details |
#12 | WRONG ANSWER | 0.28 s | 3 | details |
#13 | WRONG ANSWER | 0.29 s | 3 | details |
#14 | WRONG ANSWER | 0.29 s | 3 | details |
#15 | WRONG ANSWER | 0.27 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:36:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < best[sum - 1].size(); ++j) { ^ input/code.cpp:58:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < best[sum - 1].size(); ++j) { ^ input/code.cpp:27:6: warning: unused variable 'x' [-Wunused-variable] int x = 1; ^ input/code.cpp:28:6: warning: unused variable 'y' [-Wunused-variable] int y = 1; ^
Code
#include <iostream> #include <fstream> #include <vector> using namespace std; const int N = 2525; char board[N][N]; vector<pair<int, int> > best[2*N]; bool added[N][N]; int main() { //ifstream in; //in.open("input.in"); int n; cin >> n; for(int y = 1; y <= n; ++y) { string s; cin >> s; for(int x = 0; x < n; ++x) { board[y][x+1] = s[x]; } } int x = 1; int y = 1; string curString = ""; curString += board[1][1]; best[2].push_back(make_pair(1, 1)); for(int sum = 3; sum <= 2*n; ++sum) { vector<pair<int, int> > temp; int curBestNum = 99999; for(int j = 0; j < best[sum - 1].size(); ++j) { int x = best[sum-1][j].second; int y = best[sum-1][j].first; if(x == n) { char abba = board[y+1][x]; int cd = (int) abba; curBestNum = min(curBestNum, cd); } else if(y == n) { char abba = board[y][x+1]; int cd = (int) abba; curBestNum = min(curBestNum, cd); } else { char abba = board[y+1][x]; int cd = (int) abba; char aaaa = board[y][x+1]; int bbbb = (int) aaaa; int cur = min(cd, bbbb); curBestNum = min(curBestNum, cur); } } char a = (char) curBestNum; curString += a; for(int j = 0; j < best[sum - 1].size(); ++j) { int x = best[sum-1][j].second; int y = best[sum-1][j].first; if(x == n) { char abba = board[y+1][x]; int cd = (int) abba; if(cd == curBestNum && !added[y+1][x]) { best[sum].push_back(make_pair(y+1, x)); added[y+1][x] = true; } } else if(y == n) { char abba = board[y][x+1]; int cd = (int) abba; if(cd == curBestNum && !added[y][x+1]) { best[sum].push_back(make_pair(y, x+1)); added[y][x+1] = true; } } else { char abba = board[y+1][x]; int cd = (int) abba; if(cd == curBestNum && !added[y][x+1]) { best[sum].push_back(make_pair(y, x+1)); added[y][x+1] = true; } abba = board[y][x+1]; cd = (int) abba; if(cd == curBestNum && !added[y+1][x]) { best[sum].push_back(make_pair(y+1, x)); added[y+1][x] = true; } } } } cout << curString << "\n"; }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 ILRBG SBRHV PAGKM YKKNG ... |
correct output |
---|
ILBAGKMGQ |
user output |
---|
ILBAKZXGQ |
Test 2
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 KQQBB IWDQN TENSD PGXMV ... |
correct output |
---|
KITEGMIWH |
user output |
---|
KIQDGSIVH |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 DSWIO RWFDY ISZRK GBVYS ... |
correct output |
---|
DRIGBJDLU |
user output |
---|
DRWFBRDLU |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 VGQFP FTISL QCLYU EYNZZ ... |
correct output |
---|
VFQCLNRZP |
user output |
---|
VFQCLLUZP |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 WCSNV UWNDB WDHZA XGRBQ ... |
correct output |
---|
WCSNDBAQW |
user output |
---|
WCWDDRAGW |
Test 6
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 WFNOQZOAMZPHFRDYGXQNUPWVMFDNJF... |
correct output |
---|
WFAHHJDEVFSGGOGMIFDEEDKPSHBBRX... |
user output |
---|
WFACJIDZQGXCCNKSAFKGADGUFIQKRK... |
Test 7
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 UEOPTOSBCABXIPUOQRKWKMZRGRZUSS... |
correct output |
---|
UEGHLIWDHDVKTECPACBJABFMBOASOF... |
user output |
---|
UEAHBBWDCDFLCFCPACBQBFERMKDCOP... |
Test 8
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 XCKBHDFAPMFZNJANJUENHGXYBBHFJR... |
correct output |
---|
XCCENJBCBUFBIOJOJDREIBGRUKVRQS... |
user output |
---|
XCCBNMBGGIBUCKJODDAFIBOLHAGAHD... |
Test 9
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 YEBXYYLVUDYIHNUMRCUTAYVTNLMEZL... |
correct output |
---|
YDJNBALIRDOVFBKDDJDFNSSMIDMFRM... |
user output |
---|
YDBKBIUJIHORFOODDQFFPHJDLMTESQ... |
Test 10
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 MVONBCDHJUKRKDGPNYSYGRXBLZOMLD... |
correct output |
---|
MMSJFIKBSFCUMBBLXJCOUIRAPOKEJS... |
user output |
---|
MMOMBDGFDINSEGMBFBNAFGNBJLVOKG... |
Test 11
Group: 3
Verdict: WRONG ANSWER
input |
---|
2500 LKEFOYQTRZJHADSYBRGQCUDOPMGYOF... |
correct output |
---|
LDHPNOFPFOCGKPNCEQKANCJCBLGDKC... |
user output |
---|
LDEQNCLOFHCLKQNCEXCANFACBPINKC... |
Test 12
Group: 3
Verdict: WRONG ANSWER
input |
---|
2500 UGPBLFMZGVIANZLHRTPJIHMUZWOXKA... |
correct output |
---|
UGLSEBMGHSONFJBGOJJAGBJCLFAHAP... |
user output |
---|
UGLGEBHGHAONFEJBHAKAERKFEMAQLI... |
Test 13
Group: 3
Verdict: WRONG ANSWER
input |
---|
2500 YRUOZBRTLLMMAHNIHQLZHBYCDHTHMS... |
correct output |
---|
YELLJAAKETHCOWAJNDGJBOFNTCCEDA... |
user output |
---|
YELLPBAKATHQNWAENDGJBWFEACCBDB... |
Test 14
Group: 3
Verdict: WRONG ANSWER
input |
---|
2500 RXZEOTVYZBQUOJJFLCJCYCZDONBLUR... |
correct output |
---|
RTDHUEBGLTKRHKIQLGKILATNHWPIBO... |
user output |
---|
RTJEAEEOLAKXMJKGLGPCOPEJHXHKAD... |
Test 15
Group: 3
Verdict: WRONG ANSWER
input |
---|
2500 IOTRAMNHKWWBVPQPPWTTBHOYDFXPOX... |
correct output |
---|
IOTQTIDOBFMJBDNOFEFGGIBGAGQBIC... |
user output |
---|
IOJQYIDBDMNABDMOFEFIADAEBAOSHA... |