Submission #1890811
Source Code Expand
#include <iostream> #include <algorithm> #include <array> #include <cstdint> #include <functional> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string> #include <utility> #include <vector> #define INF 1000000000 #define MOD 1000000007 #define rep(i,a,b) for(uint32 i = (a); i < (b); ++i) #define bitget(a,b) (((a) >> (b)) & 1) #define ALL(x) (x).begin(),(x).end() #define C(x) std::cout << #x << " : " << x << std::endl #define scanf scanf_s using int32 = std::int_fast32_t; using int64 = std::int_fast64_t; using uint32 = std::uint_fast32_t; using uint64 = std::uint_fast64_t; int main(void) { std::ios::sync_with_stdio(false); std::cin.tie(0); uint32 k, t; std::cin >> k >> t; uint32 c[101] = {}; rep(i, 0, t) std::cin >> c[i]; uint32 max = 0; rep(i, 0, 101) { max = std::max(max, c[i]); } if (k & 1) { if (max <= (k >> 1) + 1) { max = 0; } else { max = (max - (k >> 1) - 1) << 1; } } else { if (max <= (k >> 1)) { max = 0; } else { max = ((max - (k >> 1)) << 1) - 1; } } std::cout << max << "\n"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - K Cakes |
User | noshi91 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1172 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
1_003.txt | AC | 1 ms | 256 KB |
1_004.txt | AC | 1 ms | 256 KB |
1_005.txt | AC | 1 ms | 256 KB |
1_006.txt | AC | 1 ms | 256 KB |
1_007.txt | AC | 1 ms | 256 KB |
1_008.txt | AC | 1 ms | 256 KB |
1_009.txt | AC | 1 ms | 256 KB |