제출 #912350

#제출 시각아이디문제언어결과실행 시간메모리
912350ArshiReconstruction Project (JOI22_reconstruction)C++17
0 / 100
2 ms6492 KiB
/**********************GOD**********************/ #include <iostream> #include <algorithm> #include <cmath> #include <iomanip> #include <cstdlib> #include <string> #include <vector> #include <set> #include <queue> #include <stack> #include <iterator> #include <map> using namespace std; //#pragma GCC optimize("O3,unroll-loops") //#pragma GCC target("sse4") typedef long long ll; typedef long double ld; typedef pair<ll , ll> pll; #define len length() #define MP make_pair #define fs first #define sc second #define pb push_back #define all(x) x.begin() , x.end() #define kill(x) cout << x , exit(0) const ll MOD = 1e9 + 7; const ll MXN = 2e5 + 4; ll n, m, q; vector<ll> E[MXN]; ll pnt[MXN]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for(ll i = 1; i <= m; i ++) { ll v, u, w; cin >> v >> u >> w; E[v].pb(w); } for(ll i = 1; i <= n; i ++) sort(all(E[i])); cin >> q; while(q --) { ll w; cin >> w; ll ans = 0; for(ll i = 1; i < n; i ++) { while(pnt[i] < E[i].size() && E[i][pnt[i]] > w) pnt[i] ++; ll x = abs(w - E[i][pnt[i]]); if(pnt[i] + 1 < E[i].size()) x = min(x, abs(w - E[i][pnt[i] + 1])); ans += x; } cout << ans << '\n'; } return 0; } /*! ahkh */

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

reconstruction.cpp: In function 'int main()':
reconstruction.cpp:58:26: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |             while(pnt[i] < E[i].size() && E[i][pnt[i]] > w)
      |                   ~~~~~~~^~~~~~~~~~~~~
reconstruction.cpp:61:27: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |             if(pnt[i] + 1 < E[i].size())
      |                ~~~~~~~~~~~^~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...