#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define xx first
#define yy second
#define MAXN 40010
using namespace std;
int n, k;
bool koji[MAXN];
ll a[MAXN], b[MAXN], ress;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin>>n>>k;
for (int i=0; i<n; i++) cin>>a[i]>>b[i];
while (k--)
{
int t; cin>>t;
for (int i=0; i<n; i++)
{
if (koji[i]==0) { if (a[i]<=t) koji[i]=1; }
else { if (b[i]<=t) koji[i]=0; }
}
}
for (int i=0; i<n; i++) if (koji[i]==0) ress+=a[i]; else ress+=b[i];
cout<<ress;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
5 ms |
332 KB |
Output is correct |
3 |
Correct |
10 ms |
376 KB |
Output is correct |
4 |
Correct |
10 ms |
376 KB |
Output is correct |
5 |
Correct |
10 ms |
372 KB |
Output is correct |
6 |
Correct |
10 ms |
380 KB |
Output is correct |
7 |
Correct |
11 ms |
368 KB |
Output is correct |
8 |
Correct |
5 ms |
332 KB |
Output is correct |
9 |
Correct |
3 ms |
332 KB |
Output is correct |
10 |
Correct |
2 ms |
332 KB |
Output is correct |
11 |
Correct |
10 ms |
332 KB |
Output is correct |
12 |
Correct |
9 ms |
332 KB |
Output is correct |
13 |
Correct |
10 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
5 ms |
332 KB |
Output is correct |
3 |
Correct |
10 ms |
376 KB |
Output is correct |
4 |
Correct |
10 ms |
376 KB |
Output is correct |
5 |
Correct |
10 ms |
372 KB |
Output is correct |
6 |
Correct |
10 ms |
380 KB |
Output is correct |
7 |
Correct |
11 ms |
368 KB |
Output is correct |
8 |
Correct |
5 ms |
332 KB |
Output is correct |
9 |
Correct |
3 ms |
332 KB |
Output is correct |
10 |
Correct |
2 ms |
332 KB |
Output is correct |
11 |
Correct |
10 ms |
332 KB |
Output is correct |
12 |
Correct |
9 ms |
332 KB |
Output is correct |
13 |
Correct |
10 ms |
332 KB |
Output is correct |
14 |
Correct |
854 ms |
764 KB |
Output is correct |
15 |
Execution timed out |
3057 ms |
1216 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
5 ms |
332 KB |
Output is correct |
3 |
Correct |
10 ms |
376 KB |
Output is correct |
4 |
Correct |
10 ms |
376 KB |
Output is correct |
5 |
Correct |
10 ms |
372 KB |
Output is correct |
6 |
Correct |
10 ms |
380 KB |
Output is correct |
7 |
Correct |
11 ms |
368 KB |
Output is correct |
8 |
Correct |
5 ms |
332 KB |
Output is correct |
9 |
Correct |
3 ms |
332 KB |
Output is correct |
10 |
Correct |
2 ms |
332 KB |
Output is correct |
11 |
Correct |
10 ms |
332 KB |
Output is correct |
12 |
Correct |
9 ms |
332 KB |
Output is correct |
13 |
Correct |
10 ms |
332 KB |
Output is correct |
14 |
Correct |
854 ms |
764 KB |
Output is correct |
15 |
Execution timed out |
3057 ms |
1216 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |