Contest Duration: - (local time) (100 minutes) Back to Home

Submission #14697012

Source Code Expand

Copy
```#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

void solve() {
int N,K;
cin >> N >> K;
// vmx[i] i個選んだ時の最大値
vector<ll> vmx(N+2,0);
vector<ll> vmn(N+2,0);
REP(i,N+1) {
vmx[i+1] = (N-i) + vmx[i];
vmn[i+1] = i + vmn[i];
}
ll sm = 0;
FOR(i,K,N+2) sm+= (vmx[i]-vmn[i]+1);

cout << (sm%ll(1e9+7)) << endl;
}

int main() {
solve();
return 0;
}
```

#### Submission Info

Submission Time 2020-06-26 21:48:53+0900 D - Sum of Large Numbers reud C++ (GCC 9.2.1) 400 896 Byte AC 9 ms 6384 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
 AC × 3
 AC × 19
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All hand_01, hand_02, max_01, max_02, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, random_10, random_11, random_12, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_01 AC 6 ms 3512 KB
hand_02 AC 2 ms 3568 KB
max_01 AC 9 ms 6324 KB
max_02 AC 8 ms 6384 KB
random_01 AC 8 ms 5552 KB
random_02 AC 6 ms 4968 KB
random_03 AC 4 ms 4756 KB
random_04 AC 3 ms 3536 KB
random_05 AC 2 ms 3532 KB
random_06 AC 2 ms 3596 KB
random_07 AC 4 ms 4660 KB
random_08 AC 4 ms 5976 KB
random_09 AC 4 ms 5068 KB
random_10 AC 5 ms 5432 KB
random_11 AC 4 ms 4916 KB
random_12 AC 5 ms 5548 KB
sample_01 AC 2 ms 3456 KB
sample_02 AC 7 ms 6172 KB
sample_03 AC 4 ms 5232 KB