| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 168222 | itgl | K번째 경로 (IZhO11_kthpath) | C++14 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int vis[35][35];
char a[35][35];
string ans;
int cnt=0;
bool ch=1;
void graph(int i,int j, string s) {
if(!ch) return;
if(i>=n||j>=m)return;
s+=a[i][j];
if(i==n-1&&j==m-1){
cnt++;
}
if(cnt==k&&ch){
ch=0;
ans=s;
return;
}
graph(i,j+1,s);
graph(i+1,j,s);
}
int main(){
cin >> n >> m;
string s;
for(int i=0;i<n;i++){
cin >> s;
for(int j=0;j<m;j++) a[i][j]=s[j];
}
cin >> k;
graph(0,0,"");
cout << ans << '\n';
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
