Submission #209104

# Submission time Handle Problem Language Result Execution time Memory
209104 2020-03-13T07:58:10 Z ArKCa Nizin (COCI16_nizin) C++17
0 / 100
1000 ms 9336 KB
 #include<bits/stdc++.h>
#define  f1   first
#define  s2   second
#define  pb   push_back
#define  pob  pop_back
#define  int  ll
#define  ll   long long 
#define  PII  pair<int,int> 
#define  N    1000006
#define  mod  1000000007

using namespace std;


int n,arka,on,arkasum,onsum,ans;
int dizi[N];
int32_t main(){	    
	 // freopen("a.gir","r",stdin);
	// freopen("a.cik","w",stdout);
   //
  // 
	scanf("%lld" ,&n);
	for(int i=0;i<n;i++){
		scanf("%lld",&dizi[i]);
	}
	arka=0;
	on=n-1;
	arkasum=0;
	onsum=0;
	while(on>arka){
		if(dizi[on]==dizi[arka]){
			on--;
			arka++;
			arkasum=0;
			onsum=0;
			continue;
		}
		if(dizi[on]>dizi[arka]){
			arkasum+=dizi[arka];
			arka++;
			onsum+=dizi[on];
			on--;
		}
		while(arkasum!=onsum ){
			if(onsum>arkasum){
				arkasum+=dizi[arka];
				arka++;
			}
			else{
				onsum+=dizi[on];
				on--;
			}
			ans++;
		}
	}
	printf("%lld\n", ans);

}


Compilation message

nizin.cpp: In function 'int32_t main()':
nizin.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld" ,&n);
  ~~~~~^~~~~~~~~~~~
nizin.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&dizi[i]);
   ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 380 KB Output is correct
3 Execution timed out 1092 ms 256 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 1020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 3708 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 7288 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 9336 KB Time limit exceeded
2 Halted 0 ms 0 KB -