제출 #668914

#제출 시각아이디문제언어결과실행 시간메모리
668914someone즐거운 행로 (APIO20_fun)C++14
47 / 100
114 ms16516 KiB
#include "fun.h" #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 42, INF = 1e18 + 42; int tmp[N]; vector<int> createFunTour(int n, int q) { int centroid = 0, dist = 0; for(int i = 1; i < n; i++) if(n - attractionsBehind(0, i) <= n/2) { int d = hoursRequired(0, i); if(d > dist) { dist = d; centroid = i; } } tmp[0] = dist; tmp[centroid] = 0; for(int i = 1; i < n; i++) if(i != centroid) tmp[i] = hoursRequired(i, centroid); priority_queue<pair<int, int>> pq; for(int i = 0; i < n; i++) pq.push({tmp[i], i}); deque<int> pre; vector<int> ans; for(int i = 0; i < n; i++) { int id = pq.top().second; pq.pop(); if(ans.empty()) ans.push_back(id); else { int last = ans.back(); if(tmp[last] + tmp[id] > hoursRequired(last, id)) pre.push_back(id); else { ans.push_back(id); if(!pre.empty()) { ans.push_back(pre[0]); pre.pop_front(); } } } } return ans; }

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

fun.cpp:5:36: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    5 | const int N = 1e5 + 42, INF = 1e18 + 42;
      |                               ~~~~~^~~~
#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...