| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 446265 | urd05 | Building Skyscrapers (CEOI19_skyscrapers) | C++17 | 199 ms | 10184 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
map<P,int> mp;
map<P,bool> vis;
int main() {
int n,t;
scanf("%d %d",&n,&t);
for(int i=0;i<n;i++) {
int x,y;
scanf("%d %d",&x,&y);
mp[P(x,y)]=i;
}
P st=(*mp.begin()).first;
vis[st]=true;
deque<P> q;
q.push_front(st);
vector<int> ret;
while (!q.empty()) {
P now=q.front();
ret.push_back(mp[now]);
q.pop_front();
int x=now.first;
int y=now.second;
if (mp.find(P(x,y-1))!=mp.end()&&!vis[P(x,y-1)]) {
q.push_front(P(x,y-1));
vis[P(x,y-1)]=true;
}
if (mp.find(P(x,y+1))!=mp.end()&&!vis[P(x,y+1)]) {
q.push_front(P(x,y+1));
vis[P(x,y+1)]=true;
}
for(int d=-1;d<=1;d++) {
if (mp.find(P(x+1,y+d))!=mp.end()&&!vis[P(x+1,y+d)]) {
q.push_back(P(x+1,y+d));
vis[P(x+1,y+d)]=true;
}
if (mp.find(P(x-1,y+d))!=mp.end()&&!vis[P(x-1,y+d)]) {
q.push_back(P(x-1,y+d));
vis[P(x-1,y+d)]=true;
}
}
}
if (ret.size()!=n) {
printf("NO");
}
else {
printf("YES\n");
for(int i=0;i<n;i++) {
printf("%d\n",ret[i]+1);
}
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
