Task: | lopov |
Sender: | Kuha |
Submission time: | 2016-07-27 16:53:24 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 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 | ACCEPTED | 0.05 s | details |
#6 | ACCEPTED | 0.05 s | details |
#7 | ACCEPTED | 0.05 s | details |
#8 | ACCEPTED | 0.09 s | details |
#9 | ACCEPTED | 0.23 s | details |
#10 | TIME LIMIT EXCEEDED | -- | details |
#11 | TIME LIMIT EXCEEDED | -- | details |
#12 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:18:11: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized] for (ll i; i <n; i++) { ^
Code
#include <bits/stdc++.h> #define ll long long #define INF 999999999 #define N (1<<17) #define M 1000000007 #define C 15133 using namespace std; int main () { cin.sync_with_stdio(false); cin.tie(0); ll n, k; cin>>n>>k; ll ans = 0; vector<pair<ll, ll>> v(n); vector<ll> w(k); for (ll i; i <n; i++) { cin>>v[i].second>>v[i].first; } for (ll i = 0; i < k; i++) { cin>>w[i]; } sort(w.begin(), w.end()); sort(v.rbegin(), v.rend()); for (ll i = 0; i < n; 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: 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: ACCEPTED
input |
---|
1000 500
1 1 80 9 82 11 131 38 ... |
correct output |
---|
6230069 |
user output |
---|
6230069 |
Test 6
Verdict: ACCEPTED
input |
---|
1000 1010
1 1 5 4 10 9 11 13 ... |
correct output |
---|
638915 |
user output |
---|
638915 |
Test 7
Verdict: ACCEPTED
input |
---|
5000 1010
1 1 49 19 55 39 69 76 ... |
correct output |
---|
10595210 |
user output |
---|
10595210 |
Test 8
Verdict: ACCEPTED
input |
---|
50000 20000
96851 85347 94211 6050 64627 18074 9696 84124 ... |
correct output |
---|
1392413902 |
user output |
---|
1392413902 |
Test 9
Verdict: ACCEPTED
input |
---|
5000 100000
0 0 0 0 1 0 0 0 ... |
correct output |
---|
1695 |
user output |
---|
1695 |
Test 10
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 100000
132731 63644 182246 131322 184048 16187 60133 177080 ... |
correct output |
---|
10022686883 |
user output |
---|
(empty) |
Test 11
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 100000
0 0 1 0 1 0 1 0 ... |
correct output |
---|
19941 |
user output |
---|
(empty) |
Test 12
Verdict: TIME LIMIT EXCEEDED
input |
---|
300000 300000
912449 903033 992783 981923 959318 988091 934786 912569 ... |
correct output |
---|
285052149031 |
user output |
---|
(empty) |