Task: | Ruudukko |
Sender: | juhoh |
Submission time: | 2015-01-29 15:05:00 +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 | ACCEPTED | 0.05 s | 1 | details |
#2 | ACCEPTED | 0.06 s | 1 | details |
#3 | WRONG ANSWER | 0.07 s | 1 | details |
#4 | WRONG ANSWER | 0.06 s | 1 | details |
#5 | WRONG ANSWER | 0.07 s | 1 | details |
#6 | ACCEPTED | 0.06 s | 2 | details |
#7 | ACCEPTED | 0.07 s | 2 | details |
#8 | WRONG ANSWER | 0.07 s | 2 | details |
#9 | WRONG ANSWER | 0.06 s | 2 | details |
#10 | WRONG ANSWER | 0.06 s | 2 | details |
#11 | ACCEPTED | 0.92 s | 3 | details |
#12 | ACCEPTED | 0.91 s | 3 | details |
#13 | WRONG ANSWER | 0.92 s | 3 | details |
#14 | WRONG ANSWER | 0.93 s | 3 | details |
#15 | WRONG ANSWER | 0.92 s | 3 | details |
Code
#include <iostream> #include <string> #include <cmath> #include <cstdio> #include <algorithm> using namespace std; typedef int ll; ll n; ll t; int main() { ios_base::sync_with_stdio(false); cin >> n; t = n*n; ll ruudut[t]; ll scores[t]; ll dirs[t]; string line; for (ll i = 0; i < t; ++i) { static char temp; cin >> temp; ruudut[i] = temp - 'A'; } for (ll k = 0; k < 2 * n; ++k) { for (ll x = 0; x < n; ++x) { for (ll y = 0; y < n; ++y) { if (x + y != k) continue; ll i = y * n + x; ll own = ruudut[i]; if (i % n == 0 && i / n == 0) { scores[i] = own; dirs[i] = 2; } else if (i % n == 0) { scores[i] = own + scores[i - n]; dirs[i] = 1; } else if (i / n == 0) { scores[i] = own + scores[i - 1]; dirs[i] = 0; } else { ll vert = own + scores[i - n]; ll hori = own + scores[i - 1]; if (vert < hori) { scores[i] = vert; dirs[i] = 1; } else { scores[i] = hori; dirs[i] = 0; } } } } } char res[2 * n - 1]; ll j = 2 * n - 2; ll i = t - 1; res[0] = ruudut[0] + 'A'; while (i != 0) { res[j] = ruudut[i] + 'A'; --j; if (dirs[i] == 0) { i -= 1; } else if (dirs[i] == 1) { i -= n; } } for (int i = 0; i < 2 * n - 1; ++i) { cout << res[i]; } cout << '\n'; return 0; }
Test details
Test 1
Group: 1
Verdict: ACCEPTED
input |
---|
5 AAAAA AAAAA AAAAA AAAAA ... |
correct output |
---|
AAAAAAAAB |
user output |
---|
AAAAAAAAB |
Test 2
Group: 1
Verdict: ACCEPTED
input |
---|
5 ABABA BABAB ABABA BABAB ... |
correct output |
---|
ABABABABA |
user output |
---|
ABABABABA |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 WRYIU TWLKH UJMJC GRDJW ... |
correct output |
---|
WRWJMDJWK |
user output |
---|
WRYIKHCWK |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 RUEAE ZYHHW KDBPD DXREW ... |
correct output |
---|
RUEAEWDWX |
user output |
---|
RUEAHPEGX |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
5 SRGYR MYDOB GNOVM SZOZK ... |
correct output |
---|
SMGNOOLTU |
user output |
---|
SRGDOBMKU |
Test 6
Group: 2
Verdict: ACCEPTED
input |
---|
100 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
user output |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
Test 7
Group: 2
Verdict: ACCEPTED
input |
---|
100 ABABABABABABABABABABABABABABAB... |
correct output |
---|
ABABABABABABABABABABABABABABAB... |
user output |
---|
ABABABABABABABABABABABABABABAB... |
Test 8
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 FWOVNYKNMMQCNHJGUYPNEDXGVVGONC... |
correct output |
---|
FWDBDECKBHKIACOVUCJGDJOHAYIBHO... |
user output |
---|
FWDBDMEFJBFPFBOOCCMACPAXBDCMDO... |
Test 9
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 ETGCJABWKMAAEOQXWFFYMDJBMNKMQK... |
correct output |
---|
EAARGLBRLHCDHHBPABHDAJBEEBHQBE... |
user output |
---|
EAARLFAALHCDHHBPABHDAJBEEBHQBE... |
Test 10
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 GNWMLJNHSBAADUFCSGIZMWHZTVDHNR... |
correct output |
---|
GEGOFRDKBNLLEUOPOEQCEFMTKANLNC... |
user output |
---|
GEGXCGEDFAEVICGBEGHKFLFBHRKDDH... |
Test 11
Group: 3
Verdict: ACCEPTED
input |
---|
500 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
user output |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
Test 12
Group: 3
Verdict: ACCEPTED
input |
---|
500 ABABABABABABABABABABABABABABAB... |
correct output |
---|
ABABABABABABABABABABABABABABAB... |
user output |
---|
ABABABABABABABABABABABABABABAB... |
Test 13
Group: 3
Verdict: WRONG ANSWER
input |
---|
500 HGADXTSFXYIEMDWMFIVQGHTACFUPYI... |
correct output |
---|
HGADEJOGAKPJCRAHTABRSDLAVGBFAG... |
user output |
---|
HGADEJOGATFGAHAHTABTBIAIBIDFAG... |
Test 14
Group: 3
Verdict: WRONG ANSWER
input |
---|
500 SBLNMAZESQVGWAPZYHQJMQTNGMEZWS... |
correct output |
---|
SBLCAMDHILGIDRCIDUNMMAHFYCENOS... |
user output |
---|
SBLCAMDHILGINDCTDBSDHBCDIBBCGI... |
Test 15
Group: 3
Verdict: WRONG ANSWER
input |
---|
500 AOXYXRYFWPYWQDPWXQITLHQQUAYZAJ... |
correct output |
---|
AOJLDOAPBGEKSGCNKBUMKAJCCWCOOD... |
user output |
---|
AOJLJJCOAVBEGEOUFAQLCQAJAFCDBD... |