Submission #2740035
Source Code Expand
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> P; const int INF = 1000000007; int main(){ int n; cin>>n; int a[210000]={0}; for(int i=0;i<n;i++) cin>>a[i]; int x=0,y=0; for(int i=0;i<n-1;i++){ x += a[i]; } y += a[n-1]; cout<<x<<" "<<y<<endl; if(n==2) cout<< abs(x - y) <<endl; else{ int mins=abs(x - y), d; for(int i=n-2;i>=1;i--){ x -= a[i]; y += a[i]; d = abs(x - y); mins = min(mins, d); cout<<x<<" "<<y<<endl<<endl; } cout<< mins <<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Splitting Pile |
User | iketyun08 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 584 Byte |
Status | WA |
Exec Time | 720 ms |
Memory | 5504 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 | WA | 2 ms | 1024 KB |
00_example_02.txt | WA | 1 ms | 1024 KB |
01.txt | WA | 352 ms | 3328 KB |
02.txt | WA | 127 ms | 1920 KB |
03.txt | WA | 107 ms | 1664 KB |
04.txt | WA | 454 ms | 3968 KB |
05.txt | WA | 106 ms | 1664 KB |
06.txt | WA | 720 ms | 5504 KB |
07.txt | WA | 712 ms | 5504 KB |
08.txt | WA | 714 ms | 5504 KB |
09.txt | WA | 714 ms | 5504 KB |
10.txt | WA | 703 ms | 5504 KB |
11.txt | WA | 2 ms | 1024 KB |
12.txt | WA | 8 ms | 1152 KB |
13.txt | WA | 667 ms | 4096 KB |
14.txt | WA | 1 ms | 1024 KB |