# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
864346 | gutzzy | Pohlepko (COCI16_pohlepko) | C++14 | 134 ms | 8244 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<vector<char>> board(n,vector<char>(m));
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin >> board[i][j];
}
}
int i = 0;
int j = 0;
string ans;
ans += board[i][j];
while(i!=n-1 or j!=m-1){
if(i==n-1){
j++;
ans+=board[i][j];
}
else if(j==m-1){
i++;
ans+=board[i][j];
}
else{
if(board[i+1][j]<board[i][j+1]){
i++;
ans+=board[i][j];
}
else{
j++;
ans+=board[i][j];
}
}
}
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |