Submission #372907

#TimeUsernameProblemLanguageResultExecution timeMemory
372907BartolMFortune Telling 2 (JOI14_fortune_telling2)C++17
4 / 100
3064 ms872 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...