Submission #72876698
Source Code Expand
#include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
using ll = long long;
using db = double;
const ll N = 1e6 + 5;
const ll md = 998244353;
const ll MOD = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db eps = 1e-6;
const db E = 2.718281828459045;
typedef pair<ll, ll> PLL;
#define fi first
#define se second
ll a[N];
void solve()
{
ll n, t;
cin >> n >> t;
for (ll i = 1; i <= n;i++)
cin >> a[i];
ll pre = -1;
ll ans = 0;
if(n==0)
{
cout << t << '\n';
return;
}
for (ll i = 1; i <= n;i++)
{
if(pre==-1)
{
ans += a[i];
pre = a[i]+100;
continue;
}
if(a[i] > pre)
{
ans += a[i] - pre;
pre = a[i] + 100;
}
}
if(pre <= t)
ans += t - pre;
cout << ans << '\n';
}
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int T;
T = 1;
//cin>>T;
while (T--)
{
solve();
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Chokutter Addiction |
| User | AChievedreaM |
| Language | C++23 (GCC 15.2.0) |
| Score | 300 |
| Code Size | 1142 Byte |
| Status | AC |
| Exec Time | 14 ms |
| Memory | 6028 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 1 ms | 3484 KiB |
| sample_02.txt | AC | 1 ms | 3424 KiB |
| sample_03.txt | AC | 1 ms | 3436 KiB |
| test_01.txt | AC | 1 ms | 3532 KiB |
| test_02.txt | AC | 1 ms | 3516 KiB |
| test_03.txt | AC | 1 ms | 3596 KiB |
| test_04.txt | AC | 12 ms | 5948 KiB |
| test_05.txt | AC | 14 ms | 6028 KiB |
| test_06.txt | AC | 1 ms | 3552 KiB |
| test_07.txt | AC | 1 ms | 3552 KiB |
| test_08.txt | AC | 3 ms | 3740 KiB |
| test_09.txt | AC | 1 ms | 3584 KiB |
| test_10.txt | AC | 1 ms | 3644 KiB |
| test_11.txt | AC | 11 ms | 5644 KiB |
| test_12.txt | AC | 1 ms | 3480 KiB |
| test_13.txt | AC | 1 ms | 3532 KiB |
| test_14.txt | AC | 3 ms | 3828 KiB |
| test_15.txt | AC | 1 ms | 3572 KiB |
| test_16.txt | AC | 11 ms | 5620 KiB |
| test_17.txt | AC | 12 ms | 5900 KiB |
| test_18.txt | AC | 13 ms | 5836 KiB |
| test_19.txt | AC | 14 ms | 5856 KiB |
| test_20.txt | AC | 14 ms | 6004 KiB |
| test_21.txt | AC | 11 ms | 5568 KiB |
| test_22.txt | AC | 12 ms | 5788 KiB |
| test_23.txt | AC | 14 ms | 6028 KiB |
| test_24.txt | AC | 14 ms | 5900 KiB |
| test_25.txt | AC | 14 ms | 6028 KiB |