| Task: | lopov |
| Sender: | Hansuzu |
| Submission time: | 2016-07-27 14:37:03 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.05 s | details |
| #2 | ACCEPTED | 0.06 s | details |
| #3 | ACCEPTED | 0.06 s | details |
| #4 | ACCEPTED | 0.05 s | details |
| #5 | WRONG ANSWER | 0.06 s | details |
| #6 | ACCEPTED | 0.06 s | details |
| #7 | WRONG ANSWER | 0.04 s | details |
| #8 | WRONG ANSWER | 0.08 s | details |
| #9 | ACCEPTED | 0.10 s | details |
| #10 | WRONG ANSWER | 0.21 s | details |
| #11 | ACCEPTED | 0.17 s | details |
| #12 | WRONG ANSWER | 0.49 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:36:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i<jw.size(); ++i){
^Code
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define MP make_pair
#define F first
#define S second
int N, K;
using namespace std;
set<long long> bags;
set<long long>::iterator it;
vector<pair<int, int> > jw;
int tr(int m){
it=bags.lower_bound(m);
if (it==bags.end()) return 0;
bags.erase(it);
return 1;
}
int main(){
cin >> N >> K;
for (int i=0; i<N; ++i){
int M, V;
cin >> M >> V;
jw.push_back(MP(-V, M));
} sort(jw.begin(), jw.end());
for (int i=0; i<K; ++i){
long long C;
cin >> C;
bags.insert(C);
}
long long ans=0;
for (int i=0; i<jw.size(); ++i){
ans-=tr(jw[i].S)*jw[i].F;
}
cout << ans << "\n";
}Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 2 1
5 10 100 100 11 |
| correct output |
|---|
| 10 |
| user output |
|---|
| 10 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 3 2
1 65 5 23 2 99 10 ... |
| correct output |
|---|
| 164 |
| user output |
|---|
| 164 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 10 10
1 1 6 5 8 12 10 20 ... |
| correct output |
|---|
| 285 |
| user output |
|---|
| 285 |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 100 500
1 1 6 9 7 12 14 19 ... |
| correct output |
|---|
| 25259 |
| user output |
|---|
| 25259 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 1000 500
1 1 80 9 82 11 131 38 ... |
| correct output |
|---|
| 6230069 |
| user output |
|---|
| 6199388 |
Test 6
Verdict: ACCEPTED
| input |
|---|
| 1000 1010
1 1 5 4 10 9 11 13 ... |
| correct output |
|---|
| 638915 |
| user output |
|---|
| 638915 |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 5000 1010
1 1 49 19 55 39 69 76 ... |
| correct output |
|---|
| 10595210 |
| user output |
|---|
| 10572217 |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 50000 20000
96851 85347 94211 6050 64627 18074 9696 84124 ... |
| correct output |
|---|
| 1392413902 |
| user output |
|---|
| 1272569982 |
Test 9
Verdict: ACCEPTED
| input |
|---|
| 5000 100000
0 0 0 0 1 0 0 0 ... |
| correct output |
|---|
| 1695 |
| user output |
|---|
| 1695 |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 100000 100000
132731 63644 182246 131322 184048 16187 60133 177080 ... |
| correct output |
|---|
| 10022686883 |
| user output |
|---|
| 9623027146 |
Test 11
Verdict: ACCEPTED
| input |
|---|
| 100000 100000
0 0 1 0 1 0 1 0 ... |
| correct output |
|---|
| 19941 |
| user output |
|---|
| 19941 |
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 300000 300000
912449 903033 992783 981923 959318 988091 934786 912569 ... |
| correct output |
|---|
| 285052149031 |
| user output |
|---|
| 36478782475 |
