Submission #2250900
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define READ freopen("alu.txt", "r", stdin); #define WRITE freopen("vorta.txt", "w", stdout); #define INFLOOP puts("lup");getchar() #define xx first #define yy second typedef long long int ll; typedef unsigned long long int ull; typedef vector<int> vi; typedef vector<int>::iterator vi_i; typedef pair<double, double> pff; const int MAX = 1e5 + 5; ll arr[MAX]; int main() { int n; scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%lld", &arr[i]); for(int i = 1; i < n; i++) arr[i] += arr[i - 1]; ll sum = arr[n - 1]; ll dif = 10000000000; for(int i = 0; i < n - 1; i++){ ll a = arr[i]; ll b = sum - arr[i]; dif = min(dif, abs(a - b)); } printf("%lld", dif); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Splitting Pile |
User | vjudge2 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 744 Byte |
Status | RE |
Exec Time | 108 ms |
Memory | 1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:23:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ ./Main.cpp:24:51: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for(int i = 0; i < n; i++) scanf("%lld", &arr[i]); ^
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 | 12 ms | 1024 KB |
02.txt | AC | 5 ms | 512 KB |
03.txt | AC | 4 ms | 512 KB |
04.txt | RE | 107 ms | 1024 KB |
05.txt | AC | 4 ms | 512 KB |
06.txt | RE | 106 ms | 1024 KB |
07.txt | RE | 106 ms | 1024 KB |
08.txt | RE | 107 ms | 1024 KB |
09.txt | RE | 107 ms | 1024 KB |
10.txt | RE | 108 ms | 1024 KB |
11.txt | AC | 1 ms | 256 KB |
12.txt | AC | 1 ms | 256 KB |
13.txt | RE | 107 ms | 1024 KB |
14.txt | AC | 3 ms | 256 KB |