제출 #1002542

#제출 시각아이디문제언어결과실행 시간메모리
1002542walizamaneeRobot (JOI21_ho_t4)C++17
34 / 100
223 ms27600 KiB
#include<bits/stdc++.h> using namespace std; int aa , m , one , two , col; long long p , ans[100001] , an[100001] , choto[200001] , chek[100001] , uttor; vector<pair<pair<int , long long> , int>> arr[100001]; //first e col , then price , then node priority_queue<pair<long long , int> , vector<pair<long long , int>> , greater<pair<long long , int>>> pq; int main() { cin >> aa >> m; for( int z = 0; z < m; z++ ) { cin >> one >> two >> col >> p; arr[one].push_back({{col , p} , two}); arr[two].push_back({{col , p} , one}); } for( int z = 1; z <= aa; z++ ) { sort( arr[z].begin() , arr[z].end() ); } ans[1] = 1; pq.push({1 , 1}); while( !pq.empty() ) { if( chek[pq.top().second] == 0 ) { chek[pq.top().second] = 1; one = pq.top().second; ans[one] = pq.top().first; for( int z = 0; z < arr[one].size(); z++ ) { an[arr[one][z].first.first] += arr[one][z].first.second; if(choto[arr[one][z].first.first] == 0 ) choto[arr[one][z].first.first] = ans[one]; if( ans[arr[one][z].second] != 0 ) { choto[arr[one][z].first.first] = min( ans[arr[one][z].second] , choto[arr[one][z].first.first] ); } } for( int z = 0; z < arr[one].size(); z++ ) { if( chek[arr[one][z].second] == 0 ) { uttor = min( (min(arr[one][z].first.second , an[arr[one][z].first.first] - arr[one][z].first.second) + ans[one] ) , (an[arr[one][z].first.first] - arr[one][z].first.second) + choto[arr[one][z].first.first] ); pq.push({uttor , arr[one][z].second}); } } for( int z = 0; z < arr[one].size(); z++ ) { an[arr[one][z].first.first] = 0; choto[arr[one][z].first.first] = 0; } } else pq.pop(); } cout << ans[aa] - 1; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:29:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, long long int>, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |          for( int z = 0; z < arr[one].size(); z++ ) {
      |                          ~~^~~~~~~~~~~~~~~~~
Main.cpp:36:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, long long int>, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |          for( int z = 0; z < arr[one].size(); z++ ) {
      |                          ~~^~~~~~~~~~~~~~~~~
Main.cpp:42:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, long long int>, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |          for( int z = 0; z < arr[one].size(); z++ ) {
      |                          ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...