Submission #2118694
Source Code Expand
#include<iostream> #include<cstring> #include<cstdio> #include<vector> #define MN 100000 using namespace std; inline int read() { int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar(); return x*f; } int n,a[MN+5]; long long ans=1e18,s[MN+5]; inline long long Abs(long long x){return x<0?-x:x;} int main() { n=read(); for(int i=1;i<=n;++i) s[i]=s[i-1]+(a[i]=read()); for(int i=1;i<n;++i) ans=min(ans,Abs(s[i]-(s[n]-s[i]))); cout<<ans; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Splitting Pile |
User | FallDream |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 586 Byte |
Status | RE |
Exec Time | 107 ms |
Memory | 1408 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 1 ms | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
01.txt | AC | 8 ms | 1408 KB |
02.txt | AC | 4 ms | 640 KB |
03.txt | AC | 3 ms | 640 KB |
04.txt | RE | 105 ms | 1408 KB |
05.txt | AC | 3 ms | 640 KB |
06.txt | WA | 8 ms | 1408 KB |
07.txt | WA | 9 ms | 1408 KB |
08.txt | WA | 8 ms | 1408 KB |
09.txt | RE | 105 ms | 1408 KB |
10.txt | RE | 107 ms | 1408 KB |
11.txt | AC | 1 ms | 256 KB |
12.txt | AC | 1 ms | 256 KB |
13.txt | WA | 6 ms | 1408 KB |
14.txt | AC | 1 ms | 256 KB |