Submission #372907

# Submission time Handle Problem Language Result Execution time Memory
372907 2021-03-02T08:51:01 Z BartolM Fortune Telling 2 (JOI14_fortune_telling2) C++17
4 / 100
3000 ms 872 KB
#include <bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, pii> pip;
typedef pair <pii, int> ppi;
typedef pair <ll, ll> pll;

const int INF=0x3f3f3f3f;
const int N=2e5+5;
const int OFF=(1<<19);

int n, q;
vector <pii> v;
vector <int> que;

void solve() {
    ll sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<q; ++j) {
            if (que[j]>=v[i].X) swap(v[i].X, v[i].Y);
        }
        sol+=v[i].X;
    }
    printf("%lld\n", sol);
}

void load() {
    scanf("%d %d", &n, &q);
    for (int i=0; i<n; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        v.pb(mp(a, b));
    }
    for (int i=0; i<q; ++i) {
        int x;
        scanf("%d", &x);
        que.pb(x);
    }
}

int main() {
    load();
    solve();
    return 0;
}

Compilation message

fortune_telling2.cpp: In function 'void load()':
fortune_telling2.cpp:35:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   35 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
fortune_telling2.cpp:38:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 |         scanf("%d %d", &a, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~~
fortune_telling2.cpp:43:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   43 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 4 ms 364 KB Output is correct
11 Correct 5 ms 364 KB Output is correct
12 Correct 3 ms 364 KB Output is correct
13 Correct 4 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 4 ms 364 KB Output is correct
11 Correct 5 ms 364 KB Output is correct
12 Correct 3 ms 364 KB Output is correct
13 Correct 4 ms 364 KB Output is correct
14 Correct 371 ms 552 KB Output is correct
15 Correct 1463 ms 748 KB Output is correct
16 Execution timed out 3064 ms 872 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 4 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 4 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 4 ms 364 KB Output is correct
11 Correct 5 ms 364 KB Output is correct
12 Correct 3 ms 364 KB Output is correct
13 Correct 4 ms 364 KB Output is correct
14 Correct 371 ms 552 KB Output is correct
15 Correct 1463 ms 748 KB Output is correct
16 Execution timed out 3064 ms 872 KB Time limit exceeded
17 Halted 0 ms 0 KB -