CSES - Datatähti 2015 loppu - Results
Submission details
Task:Ruudukko
Sender:Ollie
Submission time:2015-01-29 15:58:35 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.05 s1details
#2ACCEPTED0.04 s1details
#30.06 s1details
#4ACCEPTED0.06 s1details
#50.06 s1details
#6ACCEPTED0.06 s2details
#70.06 s2details
#80.07 s2details
#90.07 s2details
#100.07 s2details
#11ACCEPTED0.52 s3details
#120.50 s3details
#130.68 s3details
#140.69 s3details
#150.68 s3details

Code

#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vpii vector<pii>

using namespace std;

char c[501][501];
int n;
vector<string> ls;
int p[501][501];

void search(int x, int y,string s,int ff) {
	//cout << ff << endl;
	//cout << x << "," << y << endl;
	if(x>n||y>n) return;
	if(ff >= p[x][y]) return;
	p[x][y] = ff;
	if(x==n-1&&y==n-1) ls.pb(s);
	search(x+1,y,s+c[x][y],c[x][y]);
	search(x,y+1,s+c[x][y],c[x][y]);
}

int main() {
	cin.tie(0);
	
	cin >> n;
	for(int y=0;y<n;y++) {
		for(int x=0;x<n;x++) {
			char a; cin >> a;
			c[x][y] = a;
			p[x][y] = 99999999;
		}
	}
	
	search(0,0,"",0);
	sort(ls.begin(), ls.end());
	string best = ls[0]+c[n-1][n-1];
	cout << best << endl;
	
	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:

input
5
WRYIU
TWLKH
UJMJC
GRDJW
...

correct output
WRWJMDJWK

user output
WRYIUHCWK

Test 4

Group: 1

Verdict: ACCEPTED

input
5
RUEAE
ZYHHW
KDBPD
DXREW
...

correct output
RUEAEWDWX

user output
RUEAEWDWX

Test 5

Group: 1

Verdict:

input
5
SRGYR
MYDOB
GNOVM
SZOZK
...

correct output
SMGNOOLTU

user output
SRGYRBMKU

Test 6

Group: 2

Verdict: ACCEPTED

input
100
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

Test 7

Group: 2

Verdict:

input
100
ABABABABABABABABABABABABABABAB...

correct output
ABABABABABABABABABABABABABABAB...

user output
ABABABABABABABABABABABABABABAB...

Test 8

Group: 2

Verdict:

input
100
FWOVNYKNMMQCNHJGUYPNEDXGVVGONC...

correct output
FWDBDECKBHKIACOVUCJGDJOHAYIBHO...

user output
FWOVNYKNMMQCNHJGUYPNEDXGVVGONC...

Test 9

Group: 2

Verdict:

input
100
ETGCJABWKMAAEOQXWFFYMDJBMNKMQK...

correct output
EAARGLBRLHCDHHBPABHDAJBEEBHQBE...

user output
ETGCJABWKMAAEOQXWFFYMDJBMNKMQK...

Test 10

Group: 2

Verdict:

input
100
GNWMLJNHSBAADUFCSGIZMWHZTVDHNR...

correct output
GEGOFRDKBNLLEUOPOEQCEFMTKANLNC...

user output
GNWMLJNHSBAADUFCSGIZMWHZTVDHNR...

Test 11

Group: 3

Verdict: ACCEPTED

input
500
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

Test 12

Group: 3

Verdict:

input
500
ABABABABABABABABABABABABABABAB...

correct output
ABABABABABABABABABABABABABABAB...

user output
ABABABABABABABABABABABABABABAB...

Test 13

Group: 3

Verdict:

input
500
HGADXTSFXYIEMDWMFIVQGHTACFUPYI...

correct output
HGADEJOGAKPJCRAHTABRSDLAVGBFAG...

user output
HGADXTSFXYIEMDWMFIVQGHTACFUPYI...

Test 14

Group: 3

Verdict:

input
500
SBLNMAZESQVGWAPZYHQJMQTNGMEZWS...

correct output
SBLCAMDHILGIDRCIDUNMMAHFYCENOS...

user output
SBLNMAZESQVGWAPZYHQJMQTNGMEZWS...

Test 15

Group: 3

Verdict:

input
500
AOXYXRYFWPYWQDPWXQITLHQQUAYZAJ...

correct output
AOJLDOAPBGEKSGCNKBUMKAJCCWCOOD...

user output
AOXYXRYFWPYWQDPWXQITLHQQUAYZAJ...