# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
528364 | 2022-02-20T07:34:25 Z | CSQ31 | Akcija (COCI21_akcija) | C++17 | 4 ms | 640 KB |
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { int n,k; cin>>n>>k; vector<array<int,2>>v(n); for(int i=0;i<n;i++)cin>>v[i][1]>>v[i][0]; sort(v.begin(),v.end()); multiset<pair<ll,ll>>s; for(int i=0;i<n;i++){ vector<pair<ll,ll>>tmp; for(auto x:s){ if(v[i][0]-1 >= -x.first)tmp.push_back({x.first-1,x.second + v[i][1]}); } tmp.push_back({-1,v[i][1]}); for(auto x:tmp)s.insert(x); while((int)(s.size()) > k){ auto it = s.end(); it--; s.erase(it); } } if(s.size()<k)s.insert({0,0}); for(auto x:s)cout<<-x.first<<" "<<x.second<<'\n'; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 300 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 2 ms | 332 KB | Output is correct |
6 | Correct | 2 ms | 204 KB | Output is correct |
7 | Correct | 2 ms | 332 KB | Output is correct |
8 | Correct | 3 ms | 332 KB | Output is correct |
9 | Correct | 2 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 300 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 2 ms | 332 KB | Output is correct |
6 | Correct | 2 ms | 204 KB | Output is correct |
7 | Correct | 2 ms | 332 KB | Output is correct |
8 | Correct | 3 ms | 332 KB | Output is correct |
9 | Correct | 2 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Incorrect | 2 ms | 304 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 528 KB | Output is correct |
2 | Correct | 4 ms | 588 KB | Output is correct |
3 | Correct | 3 ms | 588 KB | Output is correct |
4 | Correct | 3 ms | 588 KB | Output is correct |
5 | Correct | 4 ms | 640 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Incorrect | 2 ms | 460 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 284 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 300 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 2 ms | 332 KB | Output is correct |
6 | Correct | 2 ms | 204 KB | Output is correct |
7 | Correct | 2 ms | 332 KB | Output is correct |
8 | Correct | 3 ms | 332 KB | Output is correct |
9 | Correct | 2 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Incorrect | 2 ms | 304 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |