Submission #1590415
Source Code Expand
#pragma region include #include <iostream> #include <iomanip> #include <stdio.h> #include <sstream> #include <algorithm> #include <iterator> #include <cmath> #include <complex> #include <string> #include <cstring> #include <vector> #include <tuple> #include <bitset> #include <queue> #include <complex> #include <set> #include <map> #include <stack> #include <list> #include <fstream> #include <random> //#include <time.h> #include <ctime> #pragma endregion //#include ///////// #define REP(i, x, n) for(int i = x; i < n; ++i) #define rep(i,n) REP(i,0,n) #define ALL(X) X.begin(), X.end() ///////// #pragma region typedef typedef long long LL; typedef long double LD; typedef unsigned long long ULL; typedef std::pair<LL,LL> PLL;// typedef std::pair<int,int> PII;// #pragma endregion //typedef ////定数 const int INF = (int)1e9; const LL MOD = (LL)1e9+7; const LL LINF = (LL)1e18+20; const LD PI = acos(-1.0); const double EPS = 1e-9; ///////// using namespace::std; void solve(){ int N,M,T; cin >> N >> M >> T; vector<int> A(N); for(int i=0;i<N;++i){ cin >> A[i]; } ///// int index = 0; int ans = 0; int now = 0; int pos = 0; while(index < N){ if( pos == 0 ){ ans += A[index]-M; pos = 1; now = A[index]; ++index; }else{ if( A[index] - now <= 2*M ){ now = A[index]; ++index; }else{ ans += A[index]-now -2*M; now = A[index]; ++index; } } } if( pos == 0 ){ ans += T-now; }else{ ans += max(0,T-now-M); } cout << ans << endl; } #pragma region main signed main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;//小数を10進数表示 cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別 solve(); } #pragma endregion //main()
Submission Info
Submission Time | |
---|---|
Task | B - 豪邸と宅配便 |
User | akarin55 |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1863 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_sample_00, 00_sample_01, 00_sample_02, 10_random_01, 10_random_02, 10_random_03, 10_random_04, 10_random_05, 10_random_06, 10_random_07, 10_random_08, 10_random_09, 10_random_10, 20_large_01, 20_large_02, 20_large_03, 20_large_04, 20_large_05, 30_do_not_return01, 30_do_not_return02, 30_do_not_return03, 30_do_not_return04, 30_do_not_return05 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00 | AC | 1 ms | 256 KB |
00_sample_01 | AC | 1 ms | 256 KB |
00_sample_02 | AC | 1 ms | 256 KB |
10_random_01 | AC | 1 ms | 256 KB |
10_random_02 | AC | 1 ms | 256 KB |
10_random_03 | AC | 1 ms | 256 KB |
10_random_04 | AC | 1 ms | 256 KB |
10_random_05 | AC | 1 ms | 256 KB |
10_random_06 | AC | 1 ms | 256 KB |
10_random_07 | AC | 1 ms | 256 KB |
10_random_08 | AC | 1 ms | 256 KB |
10_random_09 | AC | 1 ms | 256 KB |
10_random_10 | AC | 1 ms | 256 KB |
20_large_01 | AC | 1 ms | 256 KB |
20_large_02 | AC | 1 ms | 256 KB |
20_large_03 | AC | 1 ms | 256 KB |
20_large_04 | AC | 1 ms | 256 KB |
20_large_05 | AC | 1 ms | 256 KB |
30_do_not_return01 | AC | 1 ms | 256 KB |
30_do_not_return02 | AC | 1 ms | 256 KB |
30_do_not_return03 | AC | 1 ms | 256 KB |
30_do_not_return04 | AC | 1 ms | 256 KB |
30_do_not_return05 | AC | 1 ms | 256 KB |