Submission #86228

# Submission time Handle Problem Language Result Execution time Memory
86228 2018-11-25T13:44:04 Z MatesV13 Pohlepko (COCI16_pohlepko) C++11
0 / 80
83 ms 66560 KB
#include <bits/stdc++.h>
using namespace std;
long long n, m;
string word, unos[2000][2000], iznos[2000][2000];
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
	cin >> n >> m;
	for (int i=0;i<n;i++){
		cin >> word;
		for(int j=0;j<m;j++){
		unos[i][j] = word[j];	
    	}
	}
	iznos[0][0] = unos[0][0];
	for (int i=0;i<n;i++){
		for (int j=0;j<m;j++){
			if (i==0 && j==0) continue;
			else if (i==0) iznos[0][j] = iznos[0][j-1] + unos[0][j];
			else if (j==0) iznos[i][0] = iznos[i-1][0] + unos[i][0];
			else{
				if (iznos[i-1][j] < iznos[i][j-1]) iznos[i][j] = iznos[i-1][j] + unos[i][j];
				else iznos[i][j] = iznos[i][j-1] + unos[i][j];
			}
		}
	}
	cout << iznos[n-1][m-1];
return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 63 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 61 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 58 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 67 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 71 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 71 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 66 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 59 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 62 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 62 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
11 Runtime error 64 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
12 Runtime error 61 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
13 Runtime error 79 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
14 Runtime error 83 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
15 Runtime error 60 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
16 Runtime error 63 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)