Submission #322362

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3223622020-11-14 14:01:27minoumJakarta Skyscrapers (APIO15_skyscraper)C++17
10 / 100
1 ms1152 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAXN = 3e4 + 1, inf = INT_MAX / 2;
int n, m, b[2], d[MAXN], sz = 0;
bool wasmn[MAXN];
vector <int> ps[MAXN];
priority_queue <pair<int,int>> q;
inline void dij(){
for(int i = 0; i < n; i++) d[i] = inf;
d[b[0]] = 0;
q.push({0, b[0]});
while(!q.empty()){
while(!q.empty() && wasmn[q.top().second]) q.pop();
if(q.empty()) return;
int u = q.top().second; q.pop();
wasmn[u] = true;
if(u == b[1] || d[u] >= inf) return;
for(int k: ps[u]){
for(int i = u % k; i < n; i += k)
if(d[i] > d[u] + (abs(u - i) / k)){
d[i] = d[u] + (abs(u - i) / k);
q.push({d[i], i});
}
}
}
return;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...