Submission #738703

# Submission time Handle Problem Language Result Execution time Memory
738703 2023-05-09T12:39:25 Z Mauve Jakarta Skyscrapers (APIO15_skyscraper) C++17
57 / 100
379 ms 262144 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ss second
#define ff first
#define INF 2000000000000000
#define pb push_back
#define edge pair<ll, pair<ll,ll> > // une, number ,power
#define cost first
#define num second.first
#define pwr second.second
ll n,m,l,r,i,j,ii,jj,k,x,y,D[30005][180],s,e;
vector< edge > v[30005][180]; // number , power (powergu oroi bol power = 179)
int main(){
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(i=1;i<=m;i++){
        cin>>l>>r;
        if(i==1) s=l;
        if(i==2) e=l;
        if(r>175)
            for(j=1 ; l+r*j<n || l-r*j>=0 ; j++){
                edge a;
                a.num=l+r*j;
                a.pwr=179;
                a.cost=j;
                if(a.num<n) v[l][179].pb(a);
                a.num=l-r*j;
                if(a.num>=0) v[l][179].pb(a);
            }
        else{
            v[l][179].pb({0,{l,r}});
        }
    }
    for(i=1;i<=175;i++)
       for(j=0;j<n;j++){
            v[j][i].pb({0,{j,179}});
            if(j+i<n) v[j][i].pb({1,{j+i,i}});
            if(j-i>=0) v[j][i].pb({1,{j-i,i}});
       }
    priority_queue<edge , vector< edge >, greater< edge > > q;
    memset(D,-1,sizeof(D));
    q.push({0,{s,179}});
    while(!q.empty()){
        ll une, nmbr, power;
        une=q.top().cost;
        nmbr=q.top().num;
        power=q.top().pwr;
        q.pop();
        if(D[nmbr][power]!=-1) continue;
        D[nmbr][power]=une;
        for(edge no : v[nmbr][power]) q.push({une+no.cost,{no.num,no.pwr}});
    }
    cout<<D[e][179];
}
# Verdict Execution time Memory Grader output
1 Correct 73 ms 169436 KB Output is correct
2 Correct 76 ms 169412 KB Output is correct
3 Correct 78 ms 169380 KB Output is correct
4 Correct 82 ms 169332 KB Output is correct
5 Correct 74 ms 169436 KB Output is correct
6 Correct 73 ms 169424 KB Output is correct
7 Correct 75 ms 169468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 169420 KB Output is correct
2 Correct 80 ms 169376 KB Output is correct
3 Correct 80 ms 169448 KB Output is correct
4 Correct 83 ms 169372 KB Output is correct
5 Correct 74 ms 169356 KB Output is correct
6 Correct 73 ms 169444 KB Output is correct
7 Correct 74 ms 169472 KB Output is correct
8 Correct 79 ms 169548 KB Output is correct
9 Correct 75 ms 169860 KB Output is correct
10 Correct 79 ms 170396 KB Output is correct
11 Correct 77 ms 170468 KB Output is correct
12 Correct 83 ms 170412 KB Output is correct
13 Correct 75 ms 170448 KB Output is correct
14 Correct 79 ms 170524 KB Output is correct
15 Correct 78 ms 170484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 169420 KB Output is correct
2 Correct 88 ms 169316 KB Output is correct
3 Correct 76 ms 169388 KB Output is correct
4 Correct 75 ms 169420 KB Output is correct
5 Correct 74 ms 169372 KB Output is correct
6 Correct 78 ms 169416 KB Output is correct
7 Correct 76 ms 169468 KB Output is correct
8 Correct 75 ms 169636 KB Output is correct
9 Correct 78 ms 169864 KB Output is correct
10 Correct 79 ms 170308 KB Output is correct
11 Correct 86 ms 170404 KB Output is correct
12 Correct 84 ms 170408 KB Output is correct
13 Correct 77 ms 170368 KB Output is correct
14 Correct 78 ms 170560 KB Output is correct
15 Correct 80 ms 170456 KB Output is correct
16 Correct 80 ms 171920 KB Output is correct
17 Correct 108 ms 182404 KB Output is correct
18 Correct 140 ms 201468 KB Output is correct
19 Correct 158 ms 206396 KB Output is correct
20 Correct 155 ms 206396 KB Output is correct
21 Correct 96 ms 175436 KB Output is correct
22 Correct 150 ms 202056 KB Output is correct
23 Correct 140 ms 198600 KB Output is correct
24 Correct 156 ms 204620 KB Output is correct
25 Correct 158 ms 206416 KB Output is correct
26 Correct 155 ms 206464 KB Output is correct
27 Correct 164 ms 206516 KB Output is correct
28 Correct 155 ms 206380 KB Output is correct
29 Correct 175 ms 206416 KB Output is correct
30 Correct 163 ms 206460 KB Output is correct
31 Correct 178 ms 206536 KB Output is correct
32 Correct 162 ms 206388 KB Output is correct
33 Correct 200 ms 206572 KB Output is correct
34 Correct 203 ms 206628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 169432 KB Output is correct
2 Correct 76 ms 169352 KB Output is correct
3 Correct 74 ms 169396 KB Output is correct
4 Correct 76 ms 169440 KB Output is correct
5 Correct 74 ms 169420 KB Output is correct
6 Correct 73 ms 169420 KB Output is correct
7 Correct 74 ms 169476 KB Output is correct
8 Correct 76 ms 169568 KB Output is correct
9 Correct 79 ms 169848 KB Output is correct
10 Correct 82 ms 170252 KB Output is correct
11 Correct 81 ms 170492 KB Output is correct
12 Correct 83 ms 170348 KB Output is correct
13 Correct 82 ms 170388 KB Output is correct
14 Correct 79 ms 170564 KB Output is correct
15 Correct 79 ms 170560 KB Output is correct
16 Correct 80 ms 171848 KB Output is correct
17 Correct 110 ms 182388 KB Output is correct
18 Correct 143 ms 201500 KB Output is correct
19 Correct 155 ms 206364 KB Output is correct
20 Correct 156 ms 206396 KB Output is correct
21 Correct 91 ms 175520 KB Output is correct
22 Correct 142 ms 202108 KB Output is correct
23 Correct 140 ms 198676 KB Output is correct
24 Correct 158 ms 204660 KB Output is correct
25 Correct 156 ms 206404 KB Output is correct
26 Correct 153 ms 206416 KB Output is correct
27 Correct 153 ms 206396 KB Output is correct
28 Correct 159 ms 206444 KB Output is correct
29 Correct 179 ms 206444 KB Output is correct
30 Correct 160 ms 206280 KB Output is correct
31 Correct 175 ms 206384 KB Output is correct
32 Correct 167 ms 206284 KB Output is correct
33 Correct 202 ms 206596 KB Output is correct
34 Correct 200 ms 206596 KB Output is correct
35 Correct 177 ms 197520 KB Output is correct
36 Correct 129 ms 189020 KB Output is correct
37 Correct 235 ms 208880 KB Output is correct
38 Correct 226 ms 209852 KB Output is correct
39 Correct 229 ms 209932 KB Output is correct
40 Correct 234 ms 209988 KB Output is correct
41 Correct 237 ms 209936 KB Output is correct
42 Correct 159 ms 208316 KB Output is correct
43 Correct 160 ms 208304 KB Output is correct
44 Correct 158 ms 208336 KB Output is correct
45 Correct 366 ms 217352 KB Output is correct
46 Correct 370 ms 217128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 169488 KB Output is correct
2 Correct 77 ms 169488 KB Output is correct
3 Correct 76 ms 169424 KB Output is correct
4 Correct 75 ms 169352 KB Output is correct
5 Correct 76 ms 169424 KB Output is correct
6 Correct 76 ms 169468 KB Output is correct
7 Correct 75 ms 169476 KB Output is correct
8 Correct 76 ms 169608 KB Output is correct
9 Correct 79 ms 169856 KB Output is correct
10 Correct 81 ms 170300 KB Output is correct
11 Correct 79 ms 170456 KB Output is correct
12 Correct 78 ms 170444 KB Output is correct
13 Correct 78 ms 170544 KB Output is correct
14 Correct 80 ms 170444 KB Output is correct
15 Correct 78 ms 170528 KB Output is correct
16 Correct 81 ms 171816 KB Output is correct
17 Correct 113 ms 182388 KB Output is correct
18 Correct 143 ms 201548 KB Output is correct
19 Correct 151 ms 206308 KB Output is correct
20 Correct 150 ms 206432 KB Output is correct
21 Correct 92 ms 175560 KB Output is correct
22 Correct 143 ms 202072 KB Output is correct
23 Correct 136 ms 198696 KB Output is correct
24 Correct 154 ms 204652 KB Output is correct
25 Correct 152 ms 206408 KB Output is correct
26 Correct 158 ms 206508 KB Output is correct
27 Correct 155 ms 206388 KB Output is correct
28 Correct 166 ms 206412 KB Output is correct
29 Correct 177 ms 206512 KB Output is correct
30 Correct 160 ms 206336 KB Output is correct
31 Correct 208 ms 206340 KB Output is correct
32 Correct 156 ms 206284 KB Output is correct
33 Correct 195 ms 206560 KB Output is correct
34 Correct 195 ms 206508 KB Output is correct
35 Correct 172 ms 197492 KB Output is correct
36 Correct 134 ms 189068 KB Output is correct
37 Correct 237 ms 208800 KB Output is correct
38 Correct 226 ms 209944 KB Output is correct
39 Correct 226 ms 210000 KB Output is correct
40 Correct 223 ms 209960 KB Output is correct
41 Correct 227 ms 209992 KB Output is correct
42 Correct 159 ms 208320 KB Output is correct
43 Correct 155 ms 208324 KB Output is correct
44 Correct 157 ms 208400 KB Output is correct
45 Correct 379 ms 217316 KB Output is correct
46 Correct 353 ms 217136 KB Output is correct
47 Runtime error 222 ms 262144 KB Execution killed with signal 9
48 Halted 0 ms 0 KB -