# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
278001 | 2020-08-21T08:29:40 Z | 임성재(#5118) | Shopping Plans (CCO20_day2problem3) | C++17 | 4000 ms | 10032 KB |
#include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false); cin.tie(0); #define fi first #define se second #define em emplace #define eb emplace_back #define mp make_pair #define all(v) (v).begin(), (v).end() typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const int inf = 1e9; const ll INF = 1e18; int n, m, k; vector<int> g[200010]; bool flag; int main() { fast; cin >> n >> m >> k; for(int i=1; i<=n; i++) { int a, c; cin >> a >> c; g[a].eb(c); } vector<int> v, t; v.eb(0); for(int i=1; i<=m; i++) { t.clear(); if(g[i].empty()) v.clear(); for(auto j : g[i]) { for(auto l : v) { t.eb(l + j); } } sort(all(t)); if(t.size() > k) t.erase(t.begin() + k, t.end()); v = t; } for(int i=0; i<k; i++) { if(i < v.size()) cout << v[i] << "\n"; else cout << "-1\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 382 ms | 5496 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4080 ms | 10032 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 382 ms | 5496 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 5632 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 382 ms | 5496 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |