Submission #668562

# Submission time Handle Problem Language Result Execution time Memory
668562 2022-12-04T06:33:12 Z highway_to_hell Fortune Telling 2 (JOI14_fortune_telling2) C++14
4 / 100
3000 ms 2380 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define endl '\n'
#define pb push_back
#define mk make_pair
#define sz size()
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define kill(x) return cout << x << endl, void();
#define int ll
#define pii pair <int, int>
 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target ("avx2")
 
const int N = 1e6 + 5;
const int MOD = 998244353, INF = 2e9, sq = 300;
 
int a[2][N], c[N];
 
void Solve ()
{
    int n, k;
    cin >> n >> k;
    if (n > 40000 || k > 40000)
        return;
    for (int i = 0; i < n; i++)
        cin >> a[0][i] >> a[1][i];
    for (int i = 0; i < k; i++)
        cin >> c[i];
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int wef = 0;
        for (int j = 0; j < k; j++)
            if (c[j] >= a[wef][i])
                wef = 1 - wef;
        ans += a[wef][i];
    }
    cout << ans << endl;
}
 
int32_t main ()
{
    ios::sync_with_stdio (0), cin.tie (0), cout.tie (0);
    int tt = 1;
//  cin >> tt;
    while (tt--)
        Solve ();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 404 KB Output is correct
5 Correct 3 ms 388 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 3 ms 388 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 404 KB Output is correct
5 Correct 3 ms 388 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 3 ms 388 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 297 ms 860 KB Output is correct
15 Correct 1174 ms 1376 KB Output is correct
16 Correct 2583 ms 1912 KB Output is correct
17 Execution timed out 3065 ms 2380 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 404 KB Output is correct
5 Correct 3 ms 388 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 3 ms 388 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 297 ms 860 KB Output is correct
15 Correct 1174 ms 1376 KB Output is correct
16 Correct 2583 ms 1912 KB Output is correct
17 Execution timed out 3065 ms 2380 KB Time limit exceeded
18 Halted 0 ms 0 KB -