Submission #495992

#TimeUsernameProblemLanguageResultExecution timeMemory
495992asandikciPreokret (COCI19_preokret)C++17
44 / 50
1 ms296 KiB
#include"iostream" #include"vector" // #include"queue" // #include"deque" #include"set" // #include"map" #include"algorithm" // #include"iomanip" // #include"cstring" #define int long long using namespace std; void solve(){ int n; cin >> n; int a=0,b=0,tmp,tie=1,turna=0,turnb=0; bool ta=0,tb=0; int maxi=0; for(int i=0;i<n;i++){ cin >> tmp; if(tmp==1){ if(a<b){ ta=1; } if(ta){ turna++; } a++; turnb=0; tb=0; maxi = max(maxi,turna); } else{ if(b<a){ tb=1; } if(tb){ turnb++; } turna=0; ta=0; b++; maxi = max(maxi,turnb); } if(a==b){ tie++; } } cout << a << " " << b << "\n"; cout << tie << "\n"; cout << maxi <<"\n"; } signed main(){ // ios::sync_with_stdio(false); cin.tie(0); // freopen("","r",stdin);freopen("","w",stdout); int t=1; // cin >> t; for(int i=1;i<=t;i++){ // cout << "Case " << i << ":\n"; solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...