提出 #39010977


ソースコード 拡げる

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}

void solve(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for(auto&i:a) cin >> i;
    int ans{};
    for (int i = 0, b; i < m; i++)
    {
        cin >> b;
        --b;
        ans += a[b];
    }
    cout << ans << endl;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
}

提出情報

提出日時
問題 A - Contest Result
ユーザ Motsu_xe
言語 C++ (GCC 9.2.1)
得点 100
コード長 646 Byte
結果 AC
実行時間 6 ms
メモリ 3632 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 3588 KiB
00_sample_01.txt AC 2 ms 3624 KiB
00_sample_02.txt AC 2 ms 3440 KiB
01_random_00.txt AC 3 ms 3632 KiB
01_random_01.txt AC 2 ms 3520 KiB
01_random_02.txt AC 3 ms 3520 KiB
01_random_03.txt AC 2 ms 3580 KiB
01_random_04.txt AC 2 ms 3528 KiB
01_random_05.txt AC 2 ms 3616 KiB
01_random_06.txt AC 2 ms 3540 KiB
01_random_07.txt AC 3 ms 3572 KiB
01_random_08.txt AC 2 ms 3632 KiB
01_random_09.txt AC 2 ms 3540 KiB
02_max_00.txt AC 2 ms 3580 KiB
03_min_00.txt AC 2 ms 3508 KiB