QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#533367 | #5080. Folding Stick | JanganLupaDaftarArkavidia# | WA | 0ms | 3656kb | C++17 | 3.2kb | 2024-08-25 21:00:17 | 2024-08-25 21:00:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
// Define Template Python++
// Data Structure and Algorithm
#pragma region
#define all(vec) (vec).begin(),(vec).end()
#define sortvec(vec) sort(all(vec));
#define minvec(vec) *min_element(all(vec))
#define maxvec(vec) *max_element(all(vec))
#define uma(var,val) var=max(var,(val));
#define umi(var,val) var=min(var,(val));
#define sumvec(vec) accumulate(all(vec),0LL)
#define reversevec(vec) reverse(all(vec));
#define range(i,s,e) for(int i=s;i<e;i++)
#define range2(i,s,e) for(int i=s;i>=e;i--)
#define fors(var,arr) for(auto &var:arr)
// Input Output Manage
#define debug(x) cout<<(#x)<<" : "<<(x)<<endl;
#define test cout<<"test"<<endl;
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define floatprecision cout<<fixed<<setprecision(6);
#define fileread freopen("input.txt","r",stdin);
#define fileout freopen("output.txt","w",stdout);
#define query cin>>QUERY;while(QUERY--)
#define inputvec(vec,am) vector<int> vec(am);fors(num,vec)cin>>num;
#define inputmat(mat,n,m) vector<vector<int>> mat(n, vector<int>(m, 0));range(i,0,n)range(j,0,m)cin>>mat[i][j];
#define input(var) int var;cin>>var;
#define input2(a,b) int a,b;cin>>a>>b;
#define inputp(var) pair<int,int> var;cin>>var.first>>var.second;
#define inputs(var) string var;cin>>var;
#define print(var) cout<<(var)<<endl;
#define prints(var) cout<<(var)<<" ";
#define print2(var1,var2) cout<<(var1)<<" "<<(var2)<<endl;
#define printp(paired) cout<<(paired.first)<<" "<<(paired.second)<<endl;
#define printyes(cond) cout<<((cond)?"YES":"NO")<<endl;
#define printarr(arr) fors(num,arr){cout<<num<<" ";};cout<<endl;
#define endline cout<<endl;
#pragma endregion
// Macro
#pragma region
#define ll long long
#define pb push_back
#define pq priority_queue
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define vvi vector<vector<int>>
#define mii map<int,int>
// Oneliner Function
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll sigma(ll num){return num*(num+1)/2;}
ll gcd(ll a, ll b){return (a==0?b:gcd(b%a,a));}
ll lcm(ll a, ll b){return (a*b)/gcd(a,b);}
ll binpow(ll a,ll b,ll m=INT64_MAX){ll r=1;a%=m;while(b){if(b&1)r=(r*a)%m;a=(a*a)%m;b>>=1;}return r;}
ll invmod(ll a,ll m){return gcd(a,m)==1?binpow(a,m-2,m):0;}
ll random(ll l){return rng()%(l+1);}
ll random(ll a,ll b){ll w=b-a;return a+random(w);}
#pragma endregion
// More Macro
#pragma region
#define i32 int32_t
#define int long long
#define float long double
int QUERY;
#pragma endregion
// Constant
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const long long INF = 1e18;
const int maxn = 2e5+5;
int32_t main() {
fastIO
input(n)
inputvec(a, n)
int maxi = 0;
int cursum = 0;
range(i,0,n) {
cursum += a[i];
if (cursum >= maxi) {
maxi = cursum;
cursum = 0;
}
}
print(maxi)
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3540kb
input:
4 3 2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
5 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
7 1 3 2 3 4 2 2
output:
6
result:
ok single line: '6'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
9 5 6 3 4 8 8 2 2 5
output:
9
result:
ok single line: '9'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
10 5 6 3 4 8 6 2 1 8 5
output:
9
result:
ok single line: '9'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
10 5 8 1 2 6 8 4 3 6 5
output:
14
result:
ok single line: '14'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
3 4 2 1
output:
4
result:
ok single line: '4'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
14 7 2 2 2 2 3 4 1 3 5 4 3 1 6
output:
8
result:
ok single line: '8'
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3656kb
input:
35 46 93 64 27 72 55 77 11 17 17 79 83 74 26 32 101 54 112 92 111 77 60 51 19 105 11 68 7 100 49 88 54 106 80 57
output:
377
result:
wrong answer 1st lines differ - expected: '366', found: '377'