提出 #39010504


ソースコード 拡げる

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double PI = acos(-1);



int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    int ans = 0;
    rep(i,m) ans += a[b[i]-1];
    cout << ans << endl;
    return 0;
}

提出情報

提出日時
問題 A - Contest Result
ユーザ taki0711
言語 C++ (GCC 9.2.1)
得点 100
コード長 657 Byte
結果 AC
実行時間 6 ms
メモリ 3640 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 100 / 100
結果
AC × 3
AC × 15
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_max_00.txt, 03_min_00.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 6 ms 3464 KiB
00_sample_01.txt AC 2 ms 3432 KiB
00_sample_02.txt AC 2 ms 3432 KiB
01_random_00.txt AC 2 ms 3640 KiB
01_random_01.txt AC 3 ms 3464 KiB
01_random_02.txt AC 2 ms 3608 KiB
01_random_03.txt AC 2 ms 3604 KiB
01_random_04.txt AC 2 ms 3560 KiB
01_random_05.txt AC 2 ms 3484 KiB
01_random_06.txt AC 2 ms 3632 KiB
01_random_07.txt AC 2 ms 3604 KiB
01_random_08.txt AC 2 ms 3564 KiB
01_random_09.txt AC 3 ms 3580 KiB
02_max_00.txt AC 2 ms 3616 KiB
03_min_00.txt AC 2 ms 3488 KiB