#include <iostream>
using namespace std;
const int MAXN=200005, MAXK=200005;
int n, k;
long long a[MAXN], b[MAXN], t[MAXK], sum;
int main()
{
cin>>n>>k;
for (int i=0; i<n; i++)
cin>>a[i]>>b[i];
for (int j=0; j<k; j++)
cin>>t[j];
for (int j=0; j<k; j++)
for (int i=0; i<n; i++)
if (a[i]<=t[j])
swap(a[i], b[i]);
for (int i=0; i<n; i++)
sum+=a[i];
cout<<sum<<endl;
char I;
cin >> I;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
520 KB |
Output is correct |
3 |
Correct |
8 ms |
640 KB |
Output is correct |
4 |
Correct |
8 ms |
688 KB |
Output is correct |
5 |
Correct |
7 ms |
704 KB |
Output is correct |
6 |
Correct |
7 ms |
920 KB |
Output is correct |
7 |
Correct |
7 ms |
920 KB |
Output is correct |
8 |
Correct |
5 ms |
920 KB |
Output is correct |
9 |
Correct |
5 ms |
944 KB |
Output is correct |
10 |
Correct |
4 ms |
968 KB |
Output is correct |
11 |
Correct |
7 ms |
980 KB |
Output is correct |
12 |
Correct |
7 ms |
1028 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
520 KB |
Output is correct |
3 |
Correct |
8 ms |
640 KB |
Output is correct |
4 |
Correct |
8 ms |
688 KB |
Output is correct |
5 |
Correct |
7 ms |
704 KB |
Output is correct |
6 |
Correct |
7 ms |
920 KB |
Output is correct |
7 |
Correct |
7 ms |
920 KB |
Output is correct |
8 |
Correct |
5 ms |
920 KB |
Output is correct |
9 |
Correct |
5 ms |
944 KB |
Output is correct |
10 |
Correct |
4 ms |
968 KB |
Output is correct |
11 |
Correct |
7 ms |
980 KB |
Output is correct |
12 |
Correct |
7 ms |
1028 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
14 |
Correct |
369 ms |
1864 KB |
Output is correct |
15 |
Correct |
1473 ms |
2572 KB |
Output is correct |
16 |
Execution timed out |
3023 ms |
3636 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
520 KB |
Output is correct |
3 |
Correct |
8 ms |
640 KB |
Output is correct |
4 |
Correct |
8 ms |
688 KB |
Output is correct |
5 |
Correct |
7 ms |
704 KB |
Output is correct |
6 |
Correct |
7 ms |
920 KB |
Output is correct |
7 |
Correct |
7 ms |
920 KB |
Output is correct |
8 |
Correct |
5 ms |
920 KB |
Output is correct |
9 |
Correct |
5 ms |
944 KB |
Output is correct |
10 |
Correct |
4 ms |
968 KB |
Output is correct |
11 |
Correct |
7 ms |
980 KB |
Output is correct |
12 |
Correct |
7 ms |
1028 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
14 |
Correct |
369 ms |
1864 KB |
Output is correct |
15 |
Correct |
1473 ms |
2572 KB |
Output is correct |
16 |
Execution timed out |
3023 ms |
3636 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |