제출 #1118809

#제출 시각아이디문제언어결과실행 시간메모리
1118809Zflop나일강 (IOI24_nile)C++17
0 / 100
2040 ms6444 KiB
#include <bits/stdc++.h> using namespace std; std::vector<long long> calculate_costs( std::vector<int> W, std::vector<int> A, std::vector<int> B, std::vector<int> E) { int N = (int)W.size(); vector<long long>answers; vector<pair<int,int>>v; for (int i = 0; i < N;++i) v.push_back({-A[i] + B[i],i}); sort(v.begin(),v.end()); for (auto q : E) { long long ans = 0; vector<bool>used(N); for (int i = 0; i < N;++i) { if (!used[v[i].second]) { for (int j = i + 1; j < N;++j) if (!used[v[j].second] && abs(W[v[i].second] - W[v[j].second]) <= q) { used[v[j].second] = used[v[i].second] = true; ans += B[v[i].second] + B[v[j].second]; } } if (!used[v[i].second]) ans += A[v[i].second]; } answers.push_back(ans); } return answers; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...