| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 82159 | heon | Pohlepko (COCI16_pohlepko) | C++11 | 26 ms | 19152 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int dx[] = {1, 0};
const int dy[] = {0, 1};
bool bio[2002][2002];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,m;
cin >> n >> m;
vector <string> s(n);
for(int i = 0; i < n; i++) cin >> s[i];
vector <pair<int,int>> q;
q.push_back(make_pair(0,0));
bio[0][0] = 1;
string sol;
while(!q.empty()){
cout << s[q.back().first][q.back().second];
vector <pair<int,int>> next;
char mn = 'z';
for(auto x : q){
for(int i = 0; i < 2; i++){
int nx = dx[i] + x.first;
int ny = dy[i] + x.second;
if(nx >= n || ny >= m) continue;
mn = min(mn, s[nx][ny]);
}
}
for(auto x : q){
for(int i = 0; i < 2; i++){
int nx = dx[i] + x.first;
int ny = dy[i] + x.second;
if(nx >= n || ny >= m || s[nx][ny] != mn || bio[nx][ny]) continue;
next.push_back(make_pair(nx,ny));
bio[nx][ny] = 1;
}
}
q = next;
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
