제출 #245550

#제출 시각아이디문제언어결과실행 시간메모리
245550mat_vJakarta Skyscrapers (APIO15_skyscraper)C++14
36 / 100
1090 ms35532 KiB
#pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i)) #define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i)) #define mod 998244353 #define xx first #define yy second #define all(a) (a).begin(), (a).end() #define pb push_back #define ll long long #define pii pair<int,int> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less) mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); int n,m; pii niz[30005]; int ima[3005][3005]; vector<pii> graf[30005]; int dist[30005]; vector<int> poz[30005]; struct kurac{ int xx; int yy; }; bool operator < (const kurac &prvi, const kurac &drugi){ return prvi.yy < drugi.yy; } int main() { //ios_base::sync_with_stdio(false); cin.tie(0); cin >> m >> n; ff(i,1,n){ cin >> niz[i].xx >> niz[i].yy; poz[niz[i].xx].pb(i); } /*ff(i,1,n){ int sta = niz[i].xx%niz[i].yy; while(sta < m){ for(auto c:poz[sta]){ if(c != i)graf[i].pb({c, abs(niz[c].xx - niz[i].xx) / niz[i].yy}); } sta += niz[i].yy; } }*/ ff(i,1,n){ ff(j,1,n){ if(i == j)continue; int dist = abs(niz[i].xx - niz[j].xx); int duz = dist / niz[i].yy; if(dist % niz[i].yy == 0){ if(1 == 2)n = 5; else{ //ima[niz[i].xx][niz[i].yy] = dist; graf[niz[i].xx].pb({niz[j].xx, duz}); } } } } priority_queue<kurac> pq; pq.push({niz[1].xx,0}); ff(i,0,m-1)dist[i] = 1e9; dist[niz[1].xx] = 0; while(!pq.empty()){ kurac sta = pq.top(); pq.pop(); if(sta.yy != dist[sta.xx])continue; for(auto c:graf[sta.xx]){ if(dist[c.xx] > c.yy + sta.yy){ dist[c.xx] = c.yy + sta.yy; pq.push({c.xx, dist[c.xx]}); } } } if(dist[niz[2].xx] == 1e9)cout << -1 << "\n"; else cout << dist[niz[2].xx] << "\n"; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

skyscraper.cpp:1:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/stack:200000000")
#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...