Submission #1868655
Source Code Expand
#include<bits/stdc++.h> #define r(i,n) for(int i=0;i<n;i++) using namespace std; bool used[50]; typedef pair<int,int>P; int dx[]={-1,1}; int main(){ int n,m; cin>>n>>m; int a[n+2]; a[0]=0,a[n+1]=m; r(i,n)cin>>a[i+1]; sort(a,a+n); int ans=0; r(i,n+2){ ans+=min((m-a[i])*2,a[i]*2); } cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Collecting Balls (Easy Version) |
User | c7c7 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 342 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 | subtask0_0.txt, subtask0_1.txt, subtask0_2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | AC | 1 ms | 256 KB |
07.txt | AC | 1 ms | 256 KB |
subtask0_0.txt | AC | 1 ms | 256 KB |
subtask0_1.txt | AC | 1 ms | 256 KB |
subtask0_2.txt | AC | 1 ms | 256 KB |