제출 #1055449

#제출 시각아이디문제언어결과실행 시간메모리
1055449AdamGS즐거운 행로 (APIO20_fun)C++17
47 / 100
69 ms16856 KiB
#include "fun.h" #include<bits/stdc++.h> using namespace std; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() vector<int>createFunTour(int n, int q) { pair<int,int>mi={n, n}; rep(i, n) { pair<int,int>p={attractionsBehind(0, i), i}; if(p.st*2>=n) mi=min(mi, p); } vector<pair<int,int>>P, V[3]; rep(i, n) P.pb({hoursRequired(mi.nd, i), i}); sort(all(P)); for(int i=1; i<P.size(); ++i) { int l=0; while(l<2 && V[l].size()>0) { int x=hoursRequired(P[i].nd, V[l][0].nd); if(x==P[i].st-1) break; ++l; } V[l].pb(P[i]); } vector<int>ans; int lst=3; rep(i, n-1) { pair<int,int>ma={-1, -1}; rep(j, 3) if(j!=lst && V[j].size()) ma=max(ma, {V[j].back().st, j}); lst=ma.nd; ans.pb(V[ma.nd].back().nd); V[ma.nd].pop_back(); } ans.pb(P[0].nd); return ans; }

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

fun.cpp: In function 'std::vector<int> createFunTour(int, int)':
fun.cpp:18:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for(int i=1; i<P.size(); ++i) {
      |                ~^~~~~~~~~
#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...