제출 #1360189

#제출 시각아이디문제언어결과실행 시간메모리
1360189jahongirTriangles (CEOI18_tri)C++20
55 / 100
510 ms996 KiB
#include "trilib.h"
#include <bits/stdc++.h>
using namespace std;





signed main(){
	int N = get_n();
	
	vector<int> convex = {1,2,3};

	if(!is_clockwise(1,2,3)) swap(convex[1],convex[2]);


	for(int n = 4; n <= N; n++){
		int len = (int) convex.size();

		vector<int> cnt(len,0);
		vector<bool> smt(len,0);

		for(int i = 0; i < len; i++){
			if(!is_clockwise(convex[i],convex[(i+1)%len],n))
				cnt[i]++, cnt[(i+1)%len]++, smt[i]=true;
		}

		vector<int> vec;
		bool a = true;
		for(int i = 0; i < len; i++) if(cnt[i] != 2){
			vec.emplace_back(convex[i]);
			if(a && smt[i]){
				vec.emplace_back(n); a = false;
			}
		}

		convex.swap(vec);

	}

	give_answer((int) convex.size());

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...