Submission #2738046
Source Code Expand
#include <bits/stdc++.h> #include <typeinfo> #include <cxxabi.h> #ifdef LOCAL #include "dbgtoki.hpp" #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) #else #define DUMP(i) #endif using namespace std; #define TOSTRING(x) #x #define SZ(x) (int)(x).size() #define REP(i,n) for(int i=0;i<(n);i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define ALL(s) (s).begin(), (s).end() #define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end()); #define dis distance #define so sort #define rev reverse #define pub push_back #define sec second #define fir first typedef long long unsigned int llu; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vector <int> > vvi; const int EPS = 1e-9; const int MOD = 1e9+7; int main (){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vi A(n); int sum = 0; REP(i,n){ cin >> A[i]; sum += A[i]; } int ans = INT_MAX; int sum2 = 0; REP(i,n){ sum2 += A[i]; if(i+1 < n)ans = min(ans,abs(sum-2*sum2)); } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Splitting Pile |
User | Daylight |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1188 Byte |
Status | WA |
Exec Time | 21 ms |
Memory | 1024 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 | 2 ms | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
01.txt | WA | 11 ms | 640 KB |
02.txt | WA | 5 ms | 384 KB |
03.txt | AC | 4 ms | 384 KB |
04.txt | WA | 14 ms | 768 KB |
05.txt | WA | 4 ms | 384 KB |
06.txt | WA | 21 ms | 1024 KB |
07.txt | WA | 21 ms | 1024 KB |
08.txt | WA | 21 ms | 1024 KB |
09.txt | WA | 21 ms | 1024 KB |
10.txt | WA | 21 ms | 1024 KB |
11.txt | AC | 1 ms | 256 KB |
12.txt | AC | 1 ms | 256 KB |
13.txt | AC | 18 ms | 1024 KB |
14.txt | AC | 1 ms | 256 KB |