제출 #954268

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9542682024-03-27 14:53:15AriadnaKnapsack (NOI18_knapsack)C++14
12 / 100
3 ms468 KiB
#include <bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;
vector<pair<int, int>> compression(int n, vector<int>& v, vector<int>& w, vector<int>& k) {
map<pair<int, int>, int> comp;
for (int i = 0; i < n; ++i) {
comp[{v[i], w[i]}] += k[i];
}
for (auto& x : comp) {
if (x.second >= 3) {
comp[{2 * x.first.first, 2*x.first.second}] += (x.second - 1) / 2;
if (x.second % 2) comp[x.first] = 1;
else comp[x.first] = 2;
}
}
vector<pair<int, int>> products;
for (auto& x : comp) {
products.pb(x.first);
if (x.second == 2) products.pb(x.first);
}
return products;
}
signed main() {
int s, n;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...