Submission #5720170


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  int r[M];
  for (int i = 0; i < M; i++) {
    cin >> r[i];
  }
  int s[M + 1]{};
  for (int i = 0; i < M; i++) {
    s[i + 1] = s[i] + r[i];
  }
  double f[N + 1]{};
  for (int i = 1; i <= N; i++) {
    f[i] = f[i - 1] + log10(i);
  }
  double P = 0;
  double m = log10(M);
  int t = 0;
  for (int i = 0; i < M; i++) {
    int h = N - t;
    t += r[i];
    P += f[h] - (f[r[i]] + f[h - r[i]]) - m * r[i];
  }
  cout << ceil(-P) << "\n";
  return 0;
}

Submission Info

Submission Time
Task B - Theme Color
User yamakasa
Language C++14 (GCC 5.4.1)
Score 300
Code Size 637 Byte
Status
Exec Time 14 ms
Memory 2176 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
All 300 / 300 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
01.txt 14 ms 2176 KB
02.txt 9 ms 1408 KB
03.txt 11 ms 1792 KB
04.txt 7 ms 1280 KB
05.txt 5 ms 1024 KB
06.txt 5 ms 1024 KB
07.txt 5 ms 1024 KB
08.txt 10 ms 1408 KB
sample_01.txt 1 ms 256 KB
sample_02.txt 1 ms 256 KB