提出 #22817863


ソースコード 拡げる

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const ll modn = 1000000007;

int main()
{ 
    int n;
    cin >> n;

    vector<int> ca(n + 1, 0), cc(n + 1, 0);
    vector<vector<int> > pb(n + 1);
    vector<int> a(n), b(n), c(n);

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ca[a[i]]++;
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        pb[b[i]].push_back(i + 1);
    }
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        cc[c[i]]++;
    }

    ll res = 0, subres = 0;
    for (int i = 1; i <= n; i++) {
        subres = 0;
        for (int j = 0; j < pb[i].size(); j++) {
            subres += cc[pb[i][j]];
        }
        res += ca[i] * subres;
    }

    cout << res << endl;

    return 0;
}

提出情報

提出日時
問題 C - Made Up
ユーザ ameolp
言語 C++ (GCC 9.2.1)
得点 300
コード長 1254 Byte
結果 AC
実行時間 93 ms
メモリ 9596 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:54:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   54 |         for (int j = 0; j < pb[i].size(); j++) {
      |                         ~~^~~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 22
セット名 テストケース
Sample sample_00, sample_01, sample_02
All bound_00, bound_01, bound_02, bound_03, sample_00, sample_01, sample_02, test_00, test_01, test_02, test_03, test_04, test_05, test_06, test_07, test_08, test_09, test_10, test_11, test_12, test_13, test_14
ケース名 結果 実行時間 メモリ
bound_00 AC 90 ms 9596 KiB
bound_01 AC 88 ms 9464 KiB
bound_02 AC 2 ms 3564 KiB
bound_03 AC 2 ms 3508 KiB
sample_00 AC 2 ms 3460 KiB
sample_01 AC 2 ms 3508 KiB
sample_02 AC 2 ms 3492 KiB
test_00 AC 93 ms 9120 KiB
test_01 AC 86 ms 9160 KiB
test_02 AC 87 ms 9252 KiB
test_03 AC 76 ms 8220 KiB
test_04 AC 51 ms 6176 KiB
test_05 AC 55 ms 6956 KiB
test_06 AC 75 ms 8196 KiB
test_07 AC 54 ms 6476 KiB
test_08 AC 23 ms 4580 KiB
test_09 AC 32 ms 5272 KiB
test_10 AC 73 ms 7832 KiB
test_11 AC 48 ms 5976 KiB
test_12 AC 69 ms 7656 KiB
test_13 AC 55 ms 6628 KiB
test_14 AC 69 ms 7640 KiB