Submission #1435396
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;
#define Endl endl
/*--------------------template--------------------*/
int main()
{
cin >> n >> k;
vi v(n);
REP(i, n) cin >> v[i];
sort(ALL(v));
REP(i, k) sum += v[i];
sum += (k*(k - 1) / 2);
cout << sum << endl;
}
Submission Info
Submission Time |
|
Task |
B - オークション |
User |
tettchan |
Language |
C++14 (GCC 5.4.1) |
Score |
200 |
Code Size |
859 Byte |
Status |
AC |
Exec Time |
47 ms |
Memory |
1024 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
Status |
|
|
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 |
46 ms |
1024 KB |
in10.txt |
AC |
46 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 |
46 ms |
1024 KB |
in5.txt |
AC |
47 ms |
1024 KB |
in6.txt |
AC |
47 ms |
1024 KB |
in7.txt |
AC |
46 ms |
1024 KB |
in8.txt |
AC |
47 ms |
1024 KB |
in9.txt |
AC |
46 ms |
1024 KB |
sample1.txt |
AC |
1 ms |
256 KB |
sample2.txt |
AC |
1 ms |
256 KB |