Task: | ratar |
Sender: | Kuha |
Submission time: | 2016-07-27 17:04:36 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.06 s | details |
#2 | WRONG ANSWER | 0.05 s | details |
#3 | WRONG ANSWER | 0.06 s | details |
#4 | WRONG ANSWER | 0.05 s | details |
#5 | WRONG ANSWER | 0.06 s | details |
#6 | WRONG ANSWER | 0.05 s | details |
#7 | WRONG ANSWER | 0.06 s | details |
#8 | WRONG ANSWER | 0.06 s | details |
#9 | WRONG ANSWER | 0.05 s | details |
#10 | WRONG ANSWER | 0.06 s | details |
#11 | WRONG ANSWER | 0.06 s | details |
#12 | WRONG ANSWER | 0.05 s | details |
#13 | WRONG ANSWER | 0.06 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:16:12: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized] for (int i; i <n; i++) { ^
Code
#include <bits/stdc++.h> #define ll long long #define INF 999999999 #define N (1<<17) #define M 1000000007 using namespace std; pair<int, int> v[300001]; int main () { int n, k; cin>>n>>k; ll ans = 0; multiset<int> w; for (int i; i <n; i++) { cin>>v[i].second>>v[i].first; } for (int i = 0; i < k; i++) { int x; cin>>x; w.insert(x); } sort(v, v + n); for (int i = n - 1; i >= 0; i--) { auto p = lower_bound(w.begin(), w.end(), v[i].second); if (p != w.end()) { w.erase(p); ans += (ll)v[i].first; } } cout<<ans<<endl; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
3
1 2 3 2 3 4 3 4 8 |
correct output |
---|
7 |
user output |
---|
3 |
Test 2
Verdict: WRONG ANSWER
input |
---|
4
-1 -1 -1 -1 1 2 3 4 1 2 3 4 1 2 3 4 |
correct output |
---|
10 |
user output |
---|
0 |
Test 3
Verdict: WRONG ANSWER
input |
---|
5
-1 -1 -1 -1 -1 -2 -2 -2 -2 -2 -3 -3 -3 -3 -3 -4 -4 -4 -4 -4 ... |
correct output |
---|
36 |
user output |
---|
0 |
Test 4
Verdict: WRONG ANSWER
input |
---|
2
1 -1 -1 1 |
correct output |
---|
2 |
user output |
---|
0 |
Test 5
Verdict: WRONG ANSWER
input |
---|
5
1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 ... |
correct output |
---|
380 |
user output |
---|
1 |
Test 6
Verdict: WRONG ANSWER
input |
---|
10
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 0 ... |
correct output |
---|
7354 |
user output |
---|
0 |
Test 7
Verdict: WRONG ANSWER
input |
---|
10
420 425 490 727 888 391 514 82... |
correct output |
---|
5 |
user output |
---|
1675 |
Test 8
Verdict: WRONG ANSWER
input |
---|
31
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
correct output |
---|
667480 |
user output |
---|
0 |
Test 9
Verdict: WRONG ANSWER
input |
---|
41
475 533 -726 -189 401 -389 667... |
correct output |
---|
17456 |
user output |
---|
1356 |
Test 10
Verdict: WRONG ANSWER
input |
---|
49
495 -512 159 -874 751 -817 567... |
correct output |
---|
48443 |
user output |
---|
609 |
Test 11
Verdict: WRONG ANSWER
input |
---|
49
521 -51 -778 -977 955 -172 695... |
correct output |
---|
39082 |
user output |
---|
4600 |
Test 12
Verdict: WRONG ANSWER
input |
---|
50
500 500 500 500 500 500 500 50... |
correct output |
---|
4236645 |
user output |
---|
25000 |
Test 13
Verdict: WRONG ANSWER
input |
---|
50
933 -493 -881 936 -889 -922 -5... |
correct output |
---|
37917 |
user output |
---|
-9597 |