Submission #27114589


Source Code Expand

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); ++i)
#define REP(i, a, b) for (int i = (int)(a); (i) < (int)(b); i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

const int MOD = 1000000007;

template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}

template <class T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}


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

    vector<ll> t(n), k(n); 
    vector<vector<ll>> a(n); 
    rep(i, n) {
      cin >> t[i] >> k[i];
      rep(j, k[i]) {
        ll e = 0;
        cin >> e;
        a[i].push_back(e);
      }
    }

    ll ans = t[n-1];
    map<ll, ll> c;
    rep (h, n) {
      if (k[n-1-h] == 0) continue;
      rep(i, k[n-1-h]) {
        if (c[a[n-1-h][i]]) break;
        c[a[n-1-h][i]]++;
        ans += t[a[n-1-h][i]-1];
      }
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task C - Martial artist
User m_clove
Language C++ (GCC 9.2.1)
Score 0
Code Size 1357 Byte
Status WA
Exec Time 224 ms
Memory 29796 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 6
WA × 19
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3460 KiB
example_01.txt AC 2 ms 3604 KiB
hand_00.txt WA 41 ms 5904 KiB
hand_01.txt AC 209 ms 29796 KiB
hand_02.txt AC 224 ms 24912 KiB
hand_03.txt AC 57 ms 11048 KiB
hand_04.txt AC 1 ms 3592 KiB
random_00.txt WA 191 ms 25844 KiB
random_01.txt WA 191 ms 25848 KiB
random_02.txt WA 186 ms 21084 KiB
random_03.txt WA 187 ms 21088 KiB
random_04.txt WA 187 ms 20808 KiB
random_05.txt WA 174 ms 19248 KiB
random_06.txt WA 177 ms 19244 KiB
random_07.txt WA 179 ms 19068 KiB
random_08.txt WA 163 ms 17848 KiB
random_09.txt WA 160 ms 17912 KiB
random_10.txt WA 166 ms 17864 KiB
random_11.txt WA 144 ms 15812 KiB
random_12.txt WA 144 ms 15796 KiB
random_13.txt WA 146 ms 15724 KiB
random_14.txt WA 133 ms 14372 KiB
random_15.txt WA 134 ms 14480 KiB
random_16.txt WA 126 ms 13092 KiB
random_17.txt WA 123 ms 13088 KiB