답안 #94134

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94134 2019-01-16T11:26:41 Z farukkastamonuda Nizin (COCI16_nizin) C++14
100 / 100
89 ms 6264 KB
#include <bits/stdc++.h>
#define md 1000000007
#define fi first
#define se second
#define mp make_pair
#define	inf 1000000000
#define li 1000005
#define lo long long
#define pb push_back
#define mid (start+end)/2
using namespace std;
int n,A[li],cev;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&A[i]);
	int bas=1,son=n;
	while(bas<son){
		if(A[bas]==A[son]){
			bas++;
			son--;
			continue;
		}
		if(A[bas]<A[son]){
			bas++;
			A[bas]+=A[bas-1];
			cev++;
			continue;
		}
		if(A[bas]>A[son]){
			son--;
			A[son]+=A[son+1];
			cev++;
			continue;
		}
	}
	printf("%d\n",cev);
	return 0;
}

Compilation message

nizin.cpp: In function 'int main()':
nizin.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
nizin.cpp:15:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%d",&A[i]);
                        ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 760 KB Output is correct
2 Correct 10 ms 860 KB Output is correct
3 Correct 10 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 2424 KB Output is correct
2 Correct 39 ms 2808 KB Output is correct
3 Correct 45 ms 3320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 4808 KB Output is correct
2 Correct 70 ms 5160 KB Output is correct
3 Correct 78 ms 5692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 6136 KB Output is correct
2 Correct 87 ms 6264 KB Output is correct
3 Correct 89 ms 6264 KB Output is correct