# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
243437 | VEGAnn | Pohlepko (COCI16_pohlepko) | C++14 | 82 ms | 8184 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define i2 array<int,2>
#define PB push_back
using namespace std;
const int N = 2010;
const int oo = 2e9;
vector<i2> vc, nw;
char c[N][N];
int n, m;
string s = "";
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n >> m;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
cin >> c[i][j];
vc.PB({0, 0});
while (sz(vc) > 0){
char mn = 'z';
nw.clear();
for (i2 cr : vc)
mn = min(mn, c[cr[0]][cr[1]]);
for (i2 cr : vc){
int x = cr[0], y = cr[1];
if (c[x][y] != mn) continue;
if (x < n - 1)
nw.PB({x + 1, y});
if (y < m - 1)
nw.PB({x, y + 1});
}
s += mn;
sort(all(nw));
nw.resize(unique(all(nw)) - nw.begin());
vc = nw;
}
cout << s;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |