# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167164 | 2019-12-06T07:22:51 Z | egekabas | Pohlepko (COCI16_pohlepko) | C++14 | 1000 ms | 25060 KB |
#include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<ull, ull> pull; typedef pair<int, int> pii; typedef pair<ld, ld> pld; int n, m; char a[2009][2009]; vector<pii> cur = {{1, 1}}; vector<pii> nxt; string s; int main() { //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); scanf("%d %d", &n, &m); for(int i = 1; i <= n; ++i) for(int j = 1; j <= m; ++j) scanf("%c", &a[i][j]); s.pb(a[1][1]); while(1){ int mini = 1e9; for(auto u : cur){ if(u == mp(n, m)) goto END; if(u.ff+1 <= n) mini = min((int)a[u.ff+1][u.ss], mini); if(u.ss+1 <= m) mini = min((int)a[u.ff][u.ss+1], mini); } s.pb(mini); for(auto u : cur){ if(u.ff+1 <= n && a[u.ff+1][u.ss] == mini) nxt.pb({u.ff+1, u.ss}); if(u.ss+1 <= m && a[u.ff][u.ss+1] == mini) nxt.pb({u.ff, u.ss+1}); } cur = nxt; nxt.clear(); } END:; cout << s << "\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Incorrect | 3 ms | 1272 KB | Output isn't correct |
3 | Incorrect | 2 ms | 376 KB | Output isn't correct |
4 | Incorrect | 2 ms | 376 KB | Output isn't correct |
5 | Incorrect | 3 ms | 376 KB | Output isn't correct |
6 | Incorrect | 14 ms | 1020 KB | Output isn't correct |
7 | Execution timed out | 1060 ms | 23724 KB | Time limit exceeded |
8 | Execution timed out | 1073 ms | 25060 KB | Time limit exceeded |
9 | Incorrect | 2 ms | 504 KB | Output isn't correct |
10 | Incorrect | 5 ms | 760 KB | Output isn't correct |
11 | Incorrect | 9 ms | 504 KB | Output isn't correct |
12 | Incorrect | 21 ms | 2264 KB | Output isn't correct |
13 | Incorrect | 14 ms | 4216 KB | Output isn't correct |
14 | Execution timed out | 1079 ms | 24900 KB | Time limit exceeded |
15 | Incorrect | 27 ms | 504 KB | Output isn't correct |
16 | Execution timed out | 1085 ms | 8800 KB | Time limit exceeded |