Submission #57364856


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define rep(i, x) for (int i = 0; i < (x); i++)

int main()
{
  ll N;
  cin >> N;
  vector<ll> H(N);
  rep(i, N) cin >> H[i];
  ll T = 0; //
  for (int i = 0; i < N; i++)
  {
    int turn = H[i] / 5;
    T += turn * 3;
    H[i] -= turn * 5;

    while (H[i] > 0)
    {
      ++T;
      if (T % 3 == 0)
      {
        H[i] -= 3;
      }
      else
      {
        --H[i];
      }
    }
  }
  cout << T << endl;
  return 0;
}

Submission Info

Submission Time
Task C - Triple Attack
User ryoh1004
Language C++ 23 (gcc 12.2)
Score 300
Code Size 493 Byte
Status AC
Exec Time 53 ms
Memory 4740 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 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, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 50 ms 4740 KiB
random_02.txt AC 45 ms 4548 KiB
random_03.txt AC 51 ms 4636 KiB
random_04.txt AC 15 ms 3576 KiB
random_05.txt AC 52 ms 4740 KiB
random_06.txt AC 25 ms 3936 KiB
random_07.txt AC 51 ms 4716 KiB
random_08.txt AC 16 ms 3548 KiB
random_09.txt AC 52 ms 4676 KiB
random_10.txt AC 33 ms 4208 KiB
random_11.txt AC 51 ms 4680 KiB
random_12.txt AC 14 ms 3704 KiB
random_13.txt AC 51 ms 4740 KiB
random_14.txt AC 47 ms 4408 KiB
random_15.txt AC 51 ms 4636 KiB
random_16.txt AC 13 ms 3472 KiB
random_17.txt AC 51 ms 4660 KiB
random_18.txt AC 6 ms 3528 KiB
random_19.txt AC 20 ms 4680 KiB
random_20.txt AC 8 ms 3604 KiB
random_21.txt AC 53 ms 4648 KiB
random_22.txt AC 1 ms 3444 KiB
sample_01.txt AC 1 ms 3488 KiB
sample_02.txt AC 1 ms 3608 KiB
sample_03.txt AC 1 ms 3524 KiB