제출 #409924

#제출 시각아이디문제언어결과실행 시간메모리
409924mat_vRobot (JOI21_ho_t4)C++14
0 / 100
170 ms17324 KiB
#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<ll,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()); struct edge{ int x; int boja; ll v; }; ll maks = 1e9; int n,m; vector<edge> graf[100005]; ll dist[100005]; bool cmp(edge a, edge b){ if(a.boja < b.boja)return 1; return 0; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); maks *= maks; cin >> n >> m; ff(i,1,m){ int a,b,c,d; cin >> a >> b >> c >> d; graf[a].pb({b,c,d}); graf[b].pb({a,c,d}); } ff(i,1,n)sort(graf[i].begin(), graf[i].end(), cmp); priority_queue<pii> pq; ff(i,1,n)dist[i] = maks; dist[1] = 0; pq.push({0,1}); while(!pq.empty()){ pii sta = pq.top(); pq.pop(); int last = 0; ll sum = 0; int len = graf[sta.yy].size(); if(len == 0)continue; ff(i,0,len - 1){ if(graf[sta.yy][i].boja != graf[sta.yy][last].boja){ ff(j,last,i-1){ ll duz = min(graf[sta.yy][j].v, sum - graf[sta.yy][j].v); int koji = graf[sta.yy][j].x; if(dist[koji] > duz - sta.xx){ dist[koji] = duz - sta.xx; pq.push({-dist[koji], koji}); } } last = i; sum = graf[sta.yy][i].v; } else{ sum += graf[sta.yy][i].v; } } ff(j,last,len-1){ ll duz = min(graf[sta.yy][j].v, sum - graf[sta.yy][j].v); int koji = graf[sta.yy][j].x; if(dist[koji] > duz - sta.xx){ dist[koji] = duz - sta.xx; pq.push({-dist[koji], koji}); } } } if(dist[n] < maks)cout << dist[n] << "\n"; else cout << -1 << "\n"; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
Main.cpp:45:5: note: in expansion of macro 'ff'
   45 |     ff(i,1,m){
      |     ^~
Main.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
Main.cpp:52:5: note: in expansion of macro 'ff'
   52 |     ff(i,1,n)sort(graf[i].begin(), graf[i].end(), cmp);
      |     ^~
Main.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
Main.cpp:56:5: note: in expansion of macro 'ff'
   56 |     ff(i,1,n)dist[i] = maks;
      |     ^~
Main.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
Main.cpp:66:9: note: in expansion of macro 'ff'
   66 |         ff(i,0,len - 1){
      |         ^~
Main.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
Main.cpp:68:17: note: in expansion of macro 'ff'
   68 |                 ff(j,last,i-1){
      |                 ^~
Main.cpp:6:27: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
    6 | #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
      |                           ^
Main.cpp:83:9: note: in expansion of macro 'ff'
   83 |         ff(j,last,len-1){
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...