| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 108073 | autumn_eel | Jakarta Skyscrapers (APIO15_skyscraper) | C++14 | 3 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define int long long
#define INF 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef pair<int,int>P;
typedef long long ll;
int b[50000],t[50000];
int d[2200];
//~ int d[2200][2200];
vector<int>v[2200];
struct st{
int a,b,c;
};
bool operator<(st a,st b){
return a.c>b.c;
}
signed main(){
int n,m;cin>>n>>m;
rep(i,m){
scanf("%lld%lld",&b[i],&t[i]);
v[b[i]].push_back(t[i]);
}
memset(d,0x3f,sizeof(d));
d[0]=0;
priority_queue<st>que;
que.push({0,-1,0});
while(!que.empty()){
st p=que.top();que.pop();
int c=d[p.a];
if(c!=p.c)continue;
for(int k:v[p.a]){
for(int i=p.a,j=0;i>=0;i-=k,j++){
if(d[i]>c+j){
d[i]=c+j;
que.push({i,-1,d[i]});
}
}
for(int i=p.a,j=0;i<n;i+=k,j++){
if(d[i]>c+j){
d[i]=c+j;
que.push({i,-1,d[i]});
}
}
}
}
int ans=d[1];
if(ans==INF)puts("-1");
else cout<<ans<<endl;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
