| Task: | Ruudukko |
| Sender: | juusohe |
| Submission time: | 2015-01-29 14:59:21 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | TIME LIMIT EXCEEDED | 0 |
| #3 | TIME LIMIT EXCEEDED | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.07 s | 1 | details |
| #2 | WRONG ANSWER | 0.06 s | 1 | details |
| #3 | ACCEPTED | 0.06 s | 1 | details |
| #4 | ACCEPTED | 0.06 s | 1 | details |
| #5 | ACCEPTED | 0.07 s | 1 | details |
| #6 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #7 | RUNTIME ERROR | 2.99 s | 2 | details |
| #8 | WRONG ANSWER | 0.05 s | 2 | details |
| #9 | WRONG ANSWER | 0.06 s | 2 | details |
| #10 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #11 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #12 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #13 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #14 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #15 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
using namespace std;
int main() {
cin.sync_with_stdio(false);
long long koko = 0;
//long long stop = 0;
vector< vector<char> > ruudukko;
vector<char> rivi;
cin >> koko;
for (long long i = 0; i < koko; i++) {
for (long long j = 0; j < koko; j++) {
char x;
cin >> x;
rivi.push_back(x);
}
ruudukko.push_back(rivi);
rivi.clear();
}
vector<long long> xsijainnit;
vector<long long> ysijainnit;
vector<string> merkkijonot;
vector<bool> valmis;
valmis.push_back(false);
xsijainnit.push_back(0);
ysijainnit.push_back(0);
string q = "";
merkkijonot.push_back(q);
while (count(valmis.begin(), valmis.end(), false) > 0) {
//cout << "While\n";
for (unsigned long long i = 0; i < xsijainnit.size(); i++) {
//cout << "For " << xsijainnit.size() << '\n';
if (valmis[i] == true) continue;
if (xsijainnit[i] + 1 == koko) {
while (ysijainnit[i] < koko) {
merkkijonot[i] += ruudukko[xsijainnit[i]][ysijainnit[i]];
ysijainnit[i]++;
}
valmis[i] = true;
continue;
}
if (ysijainnit[i] + 1 == koko) {
while (xsijainnit[i] < koko) {
merkkijonot[i] += ruudukko[xsijainnit[i]][ysijainnit[i]];
xsijainnit[i]++;
}
valmis[i] = true;
continue;
}
merkkijonot[i] += ruudukko[xsijainnit[i]][ysijainnit[i]];
//std::cout << i << ": " << merkkijonot[i] << '\n';
if (ruudukko[xsijainnit[i] + 1][ysijainnit[i]] < ruudukko[xsijainnit[i]][ysijainnit[i] + 1]) {
xsijainnit[i]++;
} else if (ruudukko[xsijainnit[i] + 1][ysijainnit[i]] > ruudukko[xsijainnit[i]][ysijainnit[i] + 1]) {
ysijainnit[i]++;
} else {
valmis.push_back(false);
xsijainnit.push_back(xsijainnit[i]);
ysijainnit.push_back(ysijainnit[i]);
merkkijonot.push_back(merkkijonot[i]);
xsijainnit[i]++;
ysijainnit[i + 1]++;
//cout << "x+!\n";
}
}
}
sort(merkkijonot.begin(), merkkijonot.end());
cout << merkkijonot[0] << '\n';
}
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 5 AAAAA AAAAA AAAAA AAAAA ... |
| correct output |
|---|
| AAAAAAAAB |
| user output |
|---|
| AAAAAAAAAAAAAAAB |
Test 2
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 5 ABABA BABAB ABABA BABAB ... |
| correct output |
|---|
| ABABABABA |
| user output |
|---|
| ABAAAABAAABA |
Test 3
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 5 WRYIU TWLKH UJMJC GRDJW ... |
| correct output |
|---|
| WRWJMDJWK |
| user output |
|---|
| WRWJMDJWK |
Test 4
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 5 RUEAE ZYHHW KDBPD DXREW ... |
| correct output |
|---|
| RUEAEWDWX |
| user output |
|---|
| RUEAEWDWX |
Test 5
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 5 SRGYR MYDOB GNOVM SZOZK ... |
| correct output |
|---|
| SMGNOOLTU |
| user output |
|---|
| SMGNOOLTU |
Test 6
Group: 2
Verdict: TIME LIMIT EXCEEDED
| 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 |
|---|
| FWDBDECKBHKIACOVUCJGDJOHAYIBHO... |
Test 9
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 ETGCJABWKMAAEOQXWFFYMDJBMNKMQK... |
| correct output |
|---|
| EAARGLBRLHCDHHBPABHDAJBEEBHQBE... |
| user output |
|---|
| EAARGLBRLHCDHHBPABHDAJBEEBHBEC... |
Test 10
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100 GNWMLJNHSBAADUFCSGIZMWHZTVDHNR... |
| correct output |
|---|
| GEGOFRDKBNLLEUOPOEQCEFMTKANLNC... |
| user output |
|---|
| (empty) |
Test 11
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
| correct output |
|---|
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
| user output |
|---|
| (empty) |
Test 12
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 ABABABABABABABABABABABABABABAB... |
| correct output |
|---|
| ABABABABABABABABABABABABABABAB... |
| user output |
|---|
| (empty) |
Test 13
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 HGADXTSFXYIEMDWMFIVQGHTACFUPYI... |
| correct output |
|---|
| HGADEJOGAKPJCRAHTABRSDLAVGBFAG... |
| user output |
|---|
| (empty) |
Test 14
Group: 3
Verdict: TIME LIMIT EXCEEDED
| 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) |
