답안 #23588

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23588 2017-05-12T19:30:15 Z repeating Jakarta Skyscrapers (APIO15_skyscraper) C++11
36 / 100
1000 ms 58800 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define P push
#define pb push_back
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define W while
#define R return
#define C continue
#define SI size()
#define ll int
#define pll pair<ll,ll>
#define SF(x) scanf("%I64d",&x)

using namespace std;
const long long INF = 2e9;
long long MOD = 1e9+7;
ll n,m;
ll a[2222],b[2222];
vector<pll> adj[2222];
bool vis[2222];
priority_queue< pll , vector<pll> , greater<pll> > pq;
ll dijkstra(){
    pq.P({0,0});
    W(!pq.empty()){
        ll dis=pq.top().F,ver=pq.top().S;
        pq.pop();
        if(ver==1)R dis;
        if(vis[ver])C;
        vis[ver]=1;
        ll node,d;
        for(int i=0;i<adj[ver].SI;i++){
            node=adj[ver][i].F;
            d=dis+adj[ver][i].S;
            pq.P({d,node});
        }
    }
    R -1;
}
int main(){
    cin>>m>>n;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    ll d;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i==j)C;
            d=abs(a[i]-a[j]);
            if(d%b[i])C;
            adj[i].pb({j,d/b[i]});
        }
    }
    cout<<dijkstra();
}

Compilation message

skyscraper.cpp: In function 'int dijkstra()':
skyscraper.cpp:32:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<adj[ver].SI;i++){
                      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2092 KB Output is correct
2 Correct 0 ms 2092 KB Output is correct
3 Correct 0 ms 2092 KB Output is correct
4 Correct 0 ms 2092 KB Output is correct
5 Correct 0 ms 2092 KB Output is correct
6 Correct 0 ms 2092 KB Output is correct
7 Correct 0 ms 2092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2092 KB Output is correct
2 Correct 0 ms 2092 KB Output is correct
3 Correct 0 ms 2092 KB Output is correct
4 Correct 0 ms 2092 KB Output is correct
5 Correct 0 ms 2092 KB Output is correct
6 Correct 0 ms 2092 KB Output is correct
7 Correct 0 ms 2092 KB Output is correct
8 Correct 0 ms 2092 KB Output is correct
9 Correct 0 ms 2092 KB Output is correct
10 Correct 0 ms 2224 KB Output is correct
11 Correct 19 ms 4220 KB Output is correct
12 Correct 66 ms 34000 KB Output is correct
13 Correct 753 ms 58800 KB Output is correct
14 Correct 39 ms 4348 KB Output is correct
15 Correct 36 ms 4340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2092 KB Output is correct
2 Correct 0 ms 2092 KB Output is correct
3 Correct 0 ms 2092 KB Output is correct
4 Correct 0 ms 2092 KB Output is correct
5 Correct 0 ms 2092 KB Output is correct
6 Correct 0 ms 2092 KB Output is correct
7 Correct 0 ms 2092 KB Output is correct
8 Correct 0 ms 2092 KB Output is correct
9 Correct 0 ms 2092 KB Output is correct
10 Correct 0 ms 2224 KB Output is correct
11 Correct 26 ms 4220 KB Output is correct
12 Correct 43 ms 34000 KB Output is correct
13 Correct 709 ms 58800 KB Output is correct
14 Correct 36 ms 4348 KB Output is correct
15 Correct 39 ms 4340 KB Output is correct
16 Correct 3 ms 2360 KB Output is correct
17 Correct 19 ms 3164 KB Output is correct
18 Correct 3 ms 2224 KB Output is correct
19 Correct 0 ms 2092 KB Output is correct
20 Correct 896 ms 58800 KB Output is correct
21 Correct 6 ms 2224 KB Output is correct
22 Correct 3 ms 2092 KB Output is correct
23 Correct 6 ms 2224 KB Output is correct
24 Correct 19 ms 2368 KB Output is correct
25 Correct 19 ms 2232 KB Output is correct
26 Correct 46 ms 31092 KB Output is correct
27 Correct 53 ms 31972 KB Output is correct
28 Correct 19 ms 2356 KB Output is correct
29 Correct 6 ms 2500 KB Output is correct
30 Correct 0 ms 2092 KB Output is correct
31 Correct 3 ms 2224 KB Output is correct
32 Correct 0 ms 2224 KB Output is correct
33 Correct 63 ms 4352 KB Output is correct
34 Correct 49 ms 4348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2092 KB Output is correct
2 Correct 0 ms 2092 KB Output is correct
3 Correct 0 ms 2092 KB Output is correct
4 Correct 0 ms 2092 KB Output is correct
5 Correct 0 ms 2092 KB Output is correct
6 Correct 0 ms 2092 KB Output is correct
7 Correct 0 ms 2092 KB Output is correct
8 Correct 0 ms 2092 KB Output is correct
9 Correct 0 ms 2092 KB Output is correct
10 Correct 0 ms 2224 KB Output is correct
11 Correct 16 ms 4220 KB Output is correct
12 Correct 53 ms 34000 KB Output is correct
13 Correct 716 ms 58800 KB Output is correct
14 Correct 43 ms 4348 KB Output is correct
15 Correct 56 ms 4340 KB Output is correct
16 Correct 0 ms 2360 KB Output is correct
17 Correct 16 ms 3164 KB Output is correct
18 Correct 3 ms 2224 KB Output is correct
19 Correct 0 ms 2092 KB Output is correct
20 Execution timed out 1000 ms 58800 KB Execution timed out
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2092 KB Output is correct
2 Correct 0 ms 2092 KB Output is correct
3 Correct 0 ms 2092 KB Output is correct
4 Correct 0 ms 2092 KB Output is correct
5 Correct 0 ms 2092 KB Output is correct
6 Correct 0 ms 2092 KB Output is correct
7 Correct 0 ms 2092 KB Output is correct
8 Correct 0 ms 2092 KB Output is correct
9 Correct 0 ms 2092 KB Output is correct
10 Correct 0 ms 2224 KB Output is correct
11 Correct 26 ms 4220 KB Output is correct
12 Correct 56 ms 34000 KB Output is correct
13 Correct 679 ms 58800 KB Output is correct
14 Correct 59 ms 4348 KB Output is correct
15 Correct 36 ms 4340 KB Output is correct
16 Correct 3 ms 2360 KB Output is correct
17 Correct 16 ms 3164 KB Output is correct
18 Correct 3 ms 2224 KB Output is correct
19 Correct 3 ms 2092 KB Output is correct
20 Correct 919 ms 58800 KB Output is correct
21 Correct 6 ms 2224 KB Output is correct
22 Correct 3 ms 2092 KB Output is correct
23 Correct 3 ms 2224 KB Output is correct
24 Correct 13 ms 2368 KB Output is correct
25 Correct 16 ms 2232 KB Output is correct
26 Correct 63 ms 31092 KB Output is correct
27 Correct 59 ms 31972 KB Output is correct
28 Correct 33 ms 2356 KB Output is correct
29 Correct 6 ms 2500 KB Output is correct
30 Correct 0 ms 2092 KB Output is correct
31 Correct 3 ms 2224 KB Output is correct
32 Correct 3 ms 2224 KB Output is correct
33 Correct 49 ms 4352 KB Output is correct
34 Correct 43 ms 4348 KB Output is correct
35 Incorrect 13 ms 2224 KB Output isn't correct
36 Halted 0 ms 0 KB -