Submission #49921736
Source Code Expand
Copy
/** DRAFTplaceholder**/#include "bits/stdc++.h"using namespace std;using lint = long long;#define MULTI_TEST 0// #define cerr if (false) cerrconstexpr int MOD = 1e9 + 7; // 998244353;constexpr int MAX = 1e9 + 5;constexpr lint LMAX = 1e18 + 5;int test_case = 1;void solve() {// cerr << "Case #" << test_case++ << ":\n";int n;
/** DRAFT placeholder **/ #include "bits/stdc++.h" using namespace std; using lint = long long; #define MULTI_TEST 0 // #define cerr if (false) cerr constexpr int MOD = 1e9 + 7; // 998244353; constexpr int MAX = 1e9 + 5; constexpr lint LMAX = 1e18 + 5; int test_case = 1; void solve() { // cerr << "Case #" << test_case++ << ":\n"; int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } lint start = 0; lint cur = 0; for (int e : a) { cur += e; if (cur < 0) { start += abs(cur); cur = 0; } } lint ans = start; for (int e : a) { ans += e; } cout << ans; } signed main() { if (fopen("iii.txt", "r")) { freopen("iii.txt", "r", stdin); freopen("ooo.txt", "w", stdout); freopen("eee.txt", "w", stderr); } ios::sync_with_stdio(false); cin.tie(nullptr); cerr << __cplusplus << '\n'; int t = 1; if (MULTI_TEST) cin >> t; while (t --> 0) { solve(); cout << '\n'; } cerr << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n"; return 0; } /** -------------------------------------------------- X INPUT X -------------------------------------------------- -------------------------------------------------- X OUTPUT X -------------------------------------------------- **/
Submission Info
Submission Time | |
---|---|
Task | C - Perfect Bus |
User | Maikyou |
Language | C++ 20 (gcc 12.2) |
Score | 250 |
Code Size | 1459 Byte |
Status | AC |
Exec Time | 13 ms |
Memory | 4032 KB |
Compile Error
Main.cpp: In function ‘int main()’: Main.cpp:47:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 47 | freopen("iii.txt", "r", stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ Main.cpp:48:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 48 | freopen("ooo.txt", "w", stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ Main.cpp:49:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 49 | freopen("eee.txt", "w", stderr); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 250 / 250 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample00.txt, sample01.txt, sample02.txt |
All | sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt, testcase33.txt, testcase34.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample00.txt | AC | 1 ms | 3824 KB |
sample01.txt | AC | 1 ms | 3676 KB |
sample02.txt | AC | 1 ms | 3864 KB |
testcase00.txt | AC | 11 ms | 3916 KB |
testcase01.txt | AC | 12 ms | 3868 KB |
testcase02.txt | AC | 6 ms | 3804 KB |
testcase03.txt | AC | 11 ms | 3876 KB |
testcase04.txt | AC | 12 ms | 3876 KB |
testcase05.txt | AC | 11 ms | 3872 KB |
testcase06.txt | AC | 11 ms | 3884 KB |
testcase07.txt | AC | 11 ms | 3892 KB |
testcase08.txt | AC | 11 ms | 3984 KB |
testcase09.txt | AC | 10 ms | 3912 KB |
testcase10.txt | AC | 11 ms | 3876 KB |
testcase11.txt | AC | 11 ms | 3844 KB |
testcase12.txt | AC | 12 ms | 3848 KB |
testcase13.txt | AC | 11 ms | 3800 KB |
testcase14.txt | AC | 11 ms | 3972 KB |
testcase15.txt | AC | 10 ms | 3876 KB |
testcase16.txt | AC | 11 ms | 3888 KB |
testcase17.txt | AC | 11 ms | 4032 KB |
testcase18.txt | AC | 12 ms | 3780 KB |
testcase19.txt | AC | 12 ms | 3896 KB |
testcase20.txt | AC | 13 ms | 3912 KB |
testcase21.txt | AC | 12 ms | 3848 KB |
testcase22.txt | AC | 13 ms | 3908 KB |
testcase23.txt | AC | 13 ms | 3888 KB |
testcase24.txt | AC | 13 ms | 3976 KB |
testcase25.txt | AC | 13 ms | 3872 KB |
testcase26.txt | AC | 13 ms | 3908 KB |
testcase27.txt | AC | 12 ms | 3872 KB |
testcase28.txt | AC | 13 ms | 3884 KB |
testcase29.txt | AC | 12 ms | 3796 KB |
testcase30.txt | AC | 13 ms | 3796 KB |
testcase31.txt | AC | 12 ms | 3876 KB |
testcase32.txt | AC | 13 ms | 4028 KB |
testcase33.txt | AC | 12 ms | 3908 KB |
testcase34.txt | AC | 12 ms | 3888 KB |