답안 #23590

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23590 2017-05-12T19:52:32 Z repeating Jakarta Skyscrapers (APIO15_skyscraper) C++11
36 / 100
836 ms 68440 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 pos;
bool bol[2222][2222];
ll dijkstra(){
    pq.P({0,a[0]});
    W(!pq.empty()){
        ll dis=pq.top().F,ver=pq.top().S;
        pq.pop();
        if(ver==pos)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;
}
bool vs[2222][2222];
int main(){
    cin>>m>>n;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        if(b[i]<2000)bol[a[i]][b[i]]=1;
    }
    pos=a[1];
    for(int i=0;i<m;i++){
        for(int j=1;j<=2000;j++){
            if(!bol[i][j])C;
            for(int k=i+j,q=1;k<m;q++,k+=j){
                adj[i].pb({k,q});
            }
            for(int k=i-j,q=1;k>=0;q++,k-=j){
                adj[i].pb({k,q});
            }
        }
    }
    cout<<dijkstra();
}

Compilation message

skyscraper.cpp: In function 'int dijkstra()':
skyscraper.cpp:34: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 11732 KB Output is correct
2 Correct 0 ms 11732 KB Output is correct
3 Correct 0 ms 11732 KB Output is correct
4 Correct 0 ms 11732 KB Output is correct
5 Correct 0 ms 11732 KB Output is correct
6 Correct 0 ms 11732 KB Output is correct
7 Correct 0 ms 11732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 11732 KB Output is correct
2 Correct 0 ms 11732 KB Output is correct
3 Correct 0 ms 11732 KB Output is correct
4 Correct 0 ms 11732 KB Output is correct
5 Correct 0 ms 11732 KB Output is correct
6 Correct 0 ms 11732 KB Output is correct
7 Correct 0 ms 11732 KB Output is correct
8 Correct 0 ms 11732 KB Output is correct
9 Correct 0 ms 11732 KB Output is correct
10 Correct 0 ms 11732 KB Output is correct
11 Correct 0 ms 11864 KB Output is correct
12 Correct 0 ms 11732 KB Output is correct
13 Correct 0 ms 11864 KB Output is correct
14 Correct 0 ms 11864 KB Output is correct
15 Correct 0 ms 11864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 11732 KB Output is correct
2 Correct 0 ms 11732 KB Output is correct
3 Correct 0 ms 11732 KB Output is correct
4 Correct 0 ms 11732 KB Output is correct
5 Correct 0 ms 11732 KB Output is correct
6 Correct 0 ms 11732 KB Output is correct
7 Correct 0 ms 11732 KB Output is correct
8 Correct 0 ms 11732 KB Output is correct
9 Correct 0 ms 11732 KB Output is correct
10 Correct 0 ms 11732 KB Output is correct
11 Correct 0 ms 11864 KB Output is correct
12 Correct 0 ms 11732 KB Output is correct
13 Correct 0 ms 11864 KB Output is correct
14 Correct 0 ms 11864 KB Output is correct
15 Correct 0 ms 11864 KB Output is correct
16 Correct 0 ms 11864 KB Output is correct
17 Correct 3 ms 12168 KB Output is correct
18 Correct 3 ms 11864 KB Output is correct
19 Correct 3 ms 11864 KB Output is correct
20 Correct 823 ms 68440 KB Output is correct
21 Correct 0 ms 11732 KB Output is correct
22 Correct 3 ms 11864 KB Output is correct
23 Correct 3 ms 11864 KB Output is correct
24 Correct 3 ms 12012 KB Output is correct
25 Correct 3 ms 11864 KB Output is correct
26 Correct 6 ms 11864 KB Output is correct
27 Correct 3 ms 11864 KB Output is correct
28 Correct 3 ms 11996 KB Output is correct
29 Correct 16 ms 13316 KB Output is correct
30 Correct 6 ms 12160 KB Output is correct
31 Correct 9 ms 12540 KB Output is correct
32 Correct 6 ms 12168 KB Output is correct
33 Correct 26 ms 14740 KB Output is correct
34 Correct 19 ms 14740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 11732 KB Output is correct
2 Correct 0 ms 11732 KB Output is correct
3 Correct 0 ms 11732 KB Output is correct
4 Correct 0 ms 11732 KB Output is correct
5 Correct 0 ms 11732 KB Output is correct
6 Correct 0 ms 11732 KB Output is correct
7 Correct 0 ms 11732 KB Output is correct
8 Correct 0 ms 11732 KB Output is correct
9 Correct 0 ms 11732 KB Output is correct
10 Correct 0 ms 11732 KB Output is correct
11 Correct 0 ms 11864 KB Output is correct
12 Correct 0 ms 11732 KB Output is correct
13 Correct 0 ms 11864 KB Output is correct
14 Correct 0 ms 11864 KB Output is correct
15 Correct 0 ms 11864 KB Output is correct
16 Correct 0 ms 11864 KB Output is correct
17 Correct 3 ms 12168 KB Output is correct
18 Correct 3 ms 11864 KB Output is correct
19 Correct 3 ms 11864 KB Output is correct
20 Correct 819 ms 68440 KB Output is correct
21 Correct 0 ms 11732 KB Output is correct
22 Correct 3 ms 11864 KB Output is correct
23 Correct 3 ms 11864 KB Output is correct
24 Correct 6 ms 12012 KB Output is correct
25 Correct 3 ms 11864 KB Output is correct
26 Correct 6 ms 11864 KB Output is correct
27 Correct 3 ms 11864 KB Output is correct
28 Correct 3 ms 11996 KB Output is correct
29 Correct 13 ms 13316 KB Output is correct
30 Correct 6 ms 12160 KB Output is correct
31 Correct 6 ms 12540 KB Output is correct
32 Correct 6 ms 12168 KB Output is correct
33 Correct 26 ms 14740 KB Output is correct
34 Correct 19 ms 14740 KB Output is correct
35 Incorrect 3 ms 11864 KB Output isn't correct
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 11732 KB Output is correct
2 Correct 0 ms 11732 KB Output is correct
3 Correct 0 ms 11732 KB Output is correct
4 Correct 0 ms 11732 KB Output is correct
5 Correct 0 ms 11732 KB Output is correct
6 Correct 0 ms 11732 KB Output is correct
7 Correct 0 ms 11732 KB Output is correct
8 Correct 0 ms 11732 KB Output is correct
9 Correct 0 ms 11732 KB Output is correct
10 Correct 0 ms 11732 KB Output is correct
11 Correct 0 ms 11864 KB Output is correct
12 Correct 0 ms 11732 KB Output is correct
13 Correct 0 ms 11864 KB Output is correct
14 Correct 0 ms 11864 KB Output is correct
15 Correct 0 ms 11864 KB Output is correct
16 Correct 0 ms 11864 KB Output is correct
17 Correct 0 ms 12168 KB Output is correct
18 Correct 3 ms 11864 KB Output is correct
19 Correct 3 ms 11864 KB Output is correct
20 Correct 836 ms 68440 KB Output is correct
21 Correct 0 ms 11732 KB Output is correct
22 Correct 3 ms 11864 KB Output is correct
23 Correct 3 ms 11864 KB Output is correct
24 Correct 6 ms 12012 KB Output is correct
25 Correct 3 ms 11864 KB Output is correct
26 Correct 3 ms 11864 KB Output is correct
27 Correct 3 ms 11864 KB Output is correct
28 Correct 6 ms 11996 KB Output is correct
29 Correct 16 ms 13316 KB Output is correct
30 Correct 6 ms 12160 KB Output is correct
31 Correct 9 ms 12540 KB Output is correct
32 Correct 6 ms 12168 KB Output is correct
33 Correct 26 ms 14740 KB Output is correct
34 Correct 16 ms 14740 KB Output is correct
35 Incorrect 3 ms 11864 KB Output isn't correct
36 Halted 0 ms 0 KB -