Submission #546307

# Submission time Handle Problem Language Result Execution time Memory
546307 2022-04-07T07:41:15 Z AJ00 Pohlepko (COCI16_pohlepko) C++14
0 / 80
41 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
char ch[2000][2000];
string st[2000][2000],str;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1,r,c; 
    //cin >> t; 
    while (t--){
        cin >> r >> c;
        for (int i = 0; i < r; i++){
            cin >> str;
            for (int j = 0; j < c; j++){
                st[i][j] = "";
                ch[i][j] = str[j];
                //cin >> ch[i][j];
            }
        }
        st[0][0]+=ch[0][0];
       // cout << 0 << " " << 0 << " " << st[0][0] << "\n";
        for (int i = 1; i < r; i++){
            st[i][0] = st[i-1][0];
            st[i][0]+=ch[i][0];
       //     cout << i << " " << 0 << " " << st[i][0] << "\n";
        }
        for (int j = 1; j < c; j++){
            st[0][j] = st[0][j-1];
            st[0][j]+=ch[0][j];
         //   cout << 0 << " " << j << " " << st[0][j] << "\n";
        }
        for (int i = 1; i < r; i++){
            for (int j = 1; j < c; j++){
                if (st[i-1][j] < st[i][j-1]){
                    st[i][j] = st[i-1][j];
                }
                else {
                    st[i][j] = st[i][j-1];
                }
                st[i][j]+=ch[i][j];
          //      cout << i << " " << j << " " << st[i][j] << "\n";
            }
        }
        cout << st[r-1][c-1] << " ";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 65536 KB Execution killed with signal 9
2 Runtime error 41 ms 65536 KB Execution killed with signal 9
3 Runtime error 36 ms 65536 KB Execution killed with signal 9
4 Runtime error 33 ms 65536 KB Execution killed with signal 9
5 Runtime error 32 ms 65536 KB Execution killed with signal 9
6 Runtime error 32 ms 65536 KB Execution killed with signal 9
7 Runtime error 34 ms 65536 KB Execution killed with signal 9
8 Runtime error 34 ms 65536 KB Execution killed with signal 9
9 Runtime error 38 ms 65536 KB Execution killed with signal 9
10 Runtime error 34 ms 65536 KB Execution killed with signal 9
11 Runtime error 31 ms 65536 KB Execution killed with signal 9
12 Runtime error 34 ms 65536 KB Execution killed with signal 9
13 Runtime error 33 ms 65536 KB Execution killed with signal 9
14 Runtime error 32 ms 65536 KB Execution killed with signal 9
15 Runtime error 31 ms 65536 KB Execution killed with signal 9
16 Runtime error 35 ms 65536 KB Execution killed with signal 9