
 Code Submission Evaluation System 
Login 
HIIT Open 2018

Start:  20180526 11:00:00 
End:  20180526 16:00:00 


Tasks  Messages  Scoreboard  Statistics
CSES  HIIT Open 2018  ResultsHistory 

20180526 12:03:13  ✓ 
Task:  Find a Word 
Sender:  Ukkonen Fan Club 
Submission time:  20180526 12:03:13 
Language:  C++ 
Status:  READY 
Result:  ACCEPTED 
Test results
Code
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll dp[40][40];
ll dp2[40][40];
char t[40][40];
int main() {
ll n,k;
cin>>n>>k;
dp[n1][n1] = 1;
for(int i = n1; i >= 0; i) {
for(int j = n1; j >= 0; j) {
if(i == n1 && j == n1) continue;
dp[i][j] = dp[i+1][j] + dp[i][j+1];
}
}
/*
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
cout<<dp[i][j]<<' ';
}
cout<<'\n';
}
*/
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
cin>>t[i][j];
}
}
string res;;
for(int i = 0; i < n+n1; ++i) res.push_back('.');
ll cnt = 0;
for(int pos = 0; pos < n+n1; ++pos) {
ll mahd = 0;
//cout<<pos<<'\n';
for(int c = 'A'; c <= 'Z'; ++c) {
res[pos] = c;
memset(dp2, 0, sizeof dp2);
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
if(t[i][j] != res[i+j]) {
continue;
}
if(i == 0 && j == 0) {
dp2[i][j] = 1;
}
if(i > 0) {
dp2[i][j] += dp2[i1][j];
}
if(j > 0) {
dp2[i][j] += dp2[i][j1];
}
}
}
ll more = 0;
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
//cout<<dp2[i][j]<<' ';
if(i+j == pos) {
more += dp2[i][j] * dp[i][j];
}
}
//cout<<'\n';
}
//cout<<'\n';
//cout<<mahd<<' '<<more<<'\n';
if(mahd + more + cnt >= k) {
cnt += mahd;
break;
}
mahd += more;
}
}
cout<<res<<'\n';
}
Test details
Test 1
Verdict: ACCEPTED
input 

4 1
AAAA
AAAA
AAAA
AAAA 
Test 2
Verdict: ACCEPTED
input 

4 2
AAAA
AAAA
AAAA
AAAA 
Test 3
Verdict: ACCEPTED
input 

4 10
AAAA
AAAA
AAAA
AAAA 
Test 4
Verdict: ACCEPTED
input 

4 19
AAAA
AAAA
AAAA
AAAA 
Test 5
Verdict: ACCEPTED
input 

4 20
AAAA
AAAA
AAAA
AAAA 
Test 6
Verdict: ACCEPTED
input 

4 1
QNJP
EVJU
XHZF
RXCV 
Test 7
Verdict: ACCEPTED
input 

4 2
QNJP
EVJU
XHZF
RXCV 
Test 8
Verdict: ACCEPTED
input 

4 10
QNJP
EVJU
XHZF
RXCV 
Test 9
Verdict: ACCEPTED
input 

4 19
QNJP
EVJU
XHZF
RXCV 
Test 10
Verdict: ACCEPTED
input 

4 20
QNJP
EVJU
XHZF
RXCV 
Test 11
Verdict: ACCEPTED
input 

30 1
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
... 
correct output 

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... 
user output 

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... 
Test 12
Verdict: ACCEPTED
input 

30 15033633249770520
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
... 
correct output 

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... 
user output 

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... 
Test 13
Verdict: ACCEPTED
input 

30 30067266499541040
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAA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NVDZNZHOZGCHYAFTHHWD
DWCDSGBQZKLLXWHHWGXJQWNWENIZWZ
... 
correct output 

QNJLGFBBMJBHCCBOCEFBPLDCFGDJKB... 
user output 

QNJLGFBBMJBHCCBOCEFBPLDCFGDJKB... 
Test 15
Verdict: ACCEPTED
input 

30 15033633249770520
QNJPEVJUXHZFRXCVKBSJKUURVPLYUI
RXLGFBNQPBKQQRQFHLXUIUPLUOUOQW
FZNNUBMTLXUMTSJOOGBDBEVEYVWOLP
WYLTEQJBJRPSEMPOESVKFTQKEMSIAP
QHYOUWFHLJQDVTGVCSIVHNPKDWNJQC
GBUFNYPCWYNPQQMADZXQPYTAUETQSU
LURTALUCESXQWEFCOXPGXBFUIOMFBW
RJPAYRYBOCQKHOHRAWHJTITBTBTUQK
EMREBEZQUEFPCFEAYNTCYIBSMVIUPI
SCOSBRKAKZBPLLZPPOYCZRUTADFQEF
VKIJFVWGOCYMDCFXSEBAGJIRSKNYSK
FEVSYNRBXCOHWXGIRQOPNAIVYLXQOE
JNABESJIUMPKLSDJKBIGOSGCEJKNRN
SYROUHKKNTCYGDSSTYBQBYPOWUQIHS
YXZKTSAPWXLKLQGSNKTPGEAQIAHFMC
BAGQPHLNARILPPVQUYQOMTHOXNIKMZ
NLDRZQIWUYFGQXWCIQOCRXFUPKZWWY
AAROAOVNBBNVDZNZHOZGCHYAFTHHWD
DWCDSGBQZKLLXWHHWGXJQWNWENIZWZ
... 
correct output 

QNXZYLYURTAYRYZQUKZCYOPKYKLQPX... 
user output 

QNXZYLYURTAYRYZQUKZCYOPKYKLQPX... 
Test 16
Verdict: ACCEPTED
input 

30 30067266499541040
QNJPEVJUXHZFRXCVKBSJKUURVPLYUI
RXLGFBNQPBKQQRQFHLXUIUPLUOUOQW
FZNNUBMTLXUMTSJOOGBDBEVEYVWOLP
WYLTEQJBJRPSEMPOESVKFTQKEMSIAP
QHYOUWFHLJQDVTGVCSIVHNPKDWNJQC
GBUFNYPCWYNPQQMADZXQPYTAUETQSU
LURTALUCESXQWEFCOXPGXBFUIOMFBW
RJPAYRYBOCQKHOHRAWHJTITBTBTUQK
EMREBEZQUEFPCFEAYNTCYIBSMVIUPI
SCOSBRKAKZBPLLZPPOYCZRUTADFQEF
VKIJFVWGOCYMDCFXSEBAGJIRSKNYSK
FEVSYNRBXCOHWXGIRQOPNAIVYLXQOE
JNABESJIUMPKLSDJKBIGOSGCEJKNRN
SYROUHKKNTCYGDSSTYBQBYPOWUQIHS
YXZKTSAPWXLKLQGSNKTPGEAQIAHFMC
BAGQPHLNARILPPVQUYQOMTHOXNIKMZ
NLDRZQIWUYFGQXWCIQOCRXFUPKZWWY
AAROAOVNBBNVDZNZHOZGCHYAFTHHWD
DWCDSGBQZKLLXWHHWGXJQWNWENIZWZ
... 
correct output 

QRXZYLYURTAYRYZQUKZCYOPKYKLQPX... 
user output 

QRXZYLYURTAYRYZQUKZCYOPKYKLQPX... 