답안 #23589

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23589 2017-05-12T19:48:58 Z repeating Jakarta Skyscrapers (APIO15_skyscraper) C++11
36 / 100
969 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 23 ms 4220 KB Output is correct
12 Correct 53 ms 34000 KB Output is correct
13 Correct 736 ms 58800 KB Output is correct
14 Correct 46 ms 4348 KB Output is correct
15 Correct 39 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 23 ms 4220 KB Output is correct
12 Correct 36 ms 34000 KB Output is correct
13 Correct 706 ms 58800 KB Output is correct
14 Correct 43 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 13 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 853 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 16 ms 2368 KB Output is correct
25 Correct 16 ms 2232 KB Output is correct
26 Correct 49 ms 31092 KB Output is correct
27 Correct 56 ms 31972 KB Output is correct
28 Correct 16 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 43 ms 4352 KB Output is correct
34 Correct 39 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 3 ms 2224 KB Output is correct
11 Correct 23 ms 4220 KB Output is correct
12 Correct 63 ms 34000 KB Output is correct
13 Correct 733 ms 58800 KB Output is correct
14 Correct 43 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 0 ms 2092 KB Output is correct
20 Correct 949 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 16 ms 2368 KB Output is correct
25 Correct 19 ms 2232 KB Output is correct
26 Correct 63 ms 31092 KB Output is correct
27 Correct 56 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 36 ms 4352 KB Output is correct
34 Correct 43 ms 4348 KB Output is correct
35 Incorrect 6 ms 2224 KB Output isn't correct
36 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 46 ms 34000 KB Output is correct
13 Correct 689 ms 58800 KB Output is correct
14 Correct 43 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 13 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 969 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 16 ms 2368 KB Output is correct
25 Correct 19 ms 2232 KB Output is correct
26 Correct 53 ms 31092 KB Output is correct
27 Correct 56 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 49 ms 4352 KB Output is correct
34 Correct 43 ms 4348 KB Output is correct
35 Incorrect 6 ms 2224 KB Output isn't correct
36 Halted 0 ms 0 KB -