답안 #372907

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
372907 2021-03-02T08:51:01 Z BartolM 운세 보기 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);
      |         ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -