답안 #209082

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209082 2020-03-13T06:49:59 Z MertD014 Nizin (COCI16_nizin) C++17
100 / 100
226 ms 6520 KB
#include <bits/stdc++.h>
#define ll  long long
using namespace std;

deque<int> dq;
int n,x,ans;
int main(){
	//freopen("all.in","r",stdin);
	//freopen("all.out","w",stdout);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x;
		dq.push_back(x);
	}
	while(dq.size()>=2){
		if(dq.front()==dq.back()){
			//cout<<"=";
			dq.pop_back();
			dq.pop_front();
		}
		else if(dq.front()<dq.back()){
			//cout<<"<";
			x=dq.front();
			dq.pop_front();
			dq.front()+=x;
			ans++;
		}
		else if(dq.front()>dq.back()){
			//cout<<">";
			x=dq.back();
			dq.pop_back();
			dq.back()+=x;
			ans++;
		}
	}
	cout<<ans;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 760 KB Output is correct
2 Correct 27 ms 948 KB Output is correct
3 Correct 27 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 2552 KB Output is correct
2 Correct 108 ms 2936 KB Output is correct
3 Correct 121 ms 3448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 176 ms 4984 KB Output is correct
2 Correct 189 ms 5240 KB Output is correct
3 Correct 207 ms 6008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 226 ms 6136 KB Output is correct
2 Correct 226 ms 6520 KB Output is correct
3 Correct 222 ms 6520 KB Output is correct