Submission #1678013
Source Code Expand
#include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include <string> #include <set> #include <map> #include <queue> #include <stack> #include <cmath> #include <functional> #include <numeric> #include <iomanip> #define fi first #define se second #define fcout(n) cout<<fixed<<setprecision((n)) #define cinl(str) getline(cin,(str)) using namespace std; bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;} typedef pair<int,int> pii; typedef long long ll; typedef vector<int> vi; typedef vector<long long > vll; typedef vector< vi > vvi; double pie=acos(-1); int INF=1000000007; int dx[4] = { 0,-1,0,1 }; int dy[4] = { -1,0,1,0 }; int main() { int k,t,a[105]; int ans; cin>>k>>t; for(int i=0;i<t;i++){ cin>>a[i]; } sort(a,a+t); if(a[t-1]>k/2){ ans=k-2*(k-a[t-1])-1; } else{ ans=0; } cout<<ans<<endl; } ////途中
Submission Info
Submission Time | |
---|---|
Task | B - K Cakes |
User | Cytus |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 913 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 |