Submission #94178

# Submission time Handle Problem Language Result Execution time Memory
94178 2019-01-16T12:31:44 Z quoriess Nizin (COCI16_nizin) C++14
10 / 100
155 ms 8052 KB
#include <bits/stdc++.h>
#include <unistd.h>
#include <set>
#define dbg(x) //cout<<#x<<" has a value of: "<<x<<"\n";
typedef long long int lli;      
using namespace std;
typedef pair<lli,lli> pii;
int main(){
	int n;
	cin>>n;
	vector<lli> dizi(n);
	for (int i = 0; i < n; i++)
	{
		cin>>dizi[i];
	}
	int l=0,r=n-1;
	int cvb=0;
	while(l<=r){
		lli ls=dizi[l],rs=0;
		l++;
		int ctl=1,ctr=0;
		dbg(ls);
		dbg(rs);
		
		while(ls!=rs){
			if(l>r){
				dbg(ctl);
				dbg(ctr);
				cvb+=ctl+ctr-1;
				break;
			}	
			while(rs<ls && l<=r){
				rs+=dizi[r];
				ctr++;
				r--;
				dbg(rs);
				dbg(r);
			}
			while(ls<rs&&l<=r){
				ls+=dizi[l];
				ctl++;
				l++;
				dbg(ls);
				dbg(l);
			}	
			if(l>r && ls!=rs){
				dbg(ctl);
				dbg(ctr);
				cvb+=ctl+ctr-1;
				break;
			}	
			cvb+=ctl+ctr-2;

		}
	}
	cout<<cvb<<"\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 3080 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 149 ms 6312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 155 ms 8052 KB Output isn't correct
2 Halted 0 ms 0 KB -