Submission #1290684


Source Code Expand

// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define sum(v) accumulate(all(v), 0)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define INFLL 1000000000000000000LL
#define MOD 1000000007
#define PI acos(-1)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>

using namespace std;

// clang-format on

main {
  int n, k;
  cin >> n >> k;
  vi a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  int c = 0;
  rep(i, k) c += a[i];
  c += k * (k - 1) / 2;
  cout << c << endl;
}

Submission Info

Submission Time
Task B - オークション
User AyaMorisawa
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1184 Byte
Status AC
Exec Time 47 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 17
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt AC 47 ms 1024 KB
in10.txt AC 47 ms 1024 KB
in11.txt AC 47 ms 1024 KB
in12.txt AC 46 ms 1024 KB
in13.txt AC 1 ms 256 KB
in2.txt AC 46 ms 1024 KB
in3.txt AC 47 ms 1024 KB
in4.txt AC 47 ms 1024 KB
in5.txt AC 47 ms 1024 KB
in6.txt AC 46 ms 1024 KB
in7.txt AC 47 ms 1024 KB
in8.txt AC 47 ms 1024 KB
in9.txt AC 47 ms 1024 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB