Submission #1570678


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x1 uvuvwevwevwe
#define y1 onyetenyevwe
#define x2 ugwemubwem
#define y2 ossas
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
template <typename T> void scan(T &angka){
	angka=0;char input=gc();T kali=1;
	while(!(48<=input&&input<=57)){	if(input=='-')	kali=-1;input=gc();}
	while(48<=input&&input<=57)	angka=(angka<<3)+(angka<<1)+input-48,input=gc();angka*=kali;
}
template <typename T1,typename T2> void scan(T1 &angka1,T2 &angka2){
	scan(angka1);scan(angka2);
}
int n;
const LL mods=998244353;
struct point{
	int x,y;
	point (int _x,int _y){
		x=_x;
		y=_y;
	}
	point(){
	}
};
struct M{
	LL x;
	M(LL angka){
		if(angka>=mods||angka<=-mods)
			angka%=mods;
		if(angka<0)
			angka+=mods;
		x=angka;
	}
	M(){
		x=0;
	}
	M operator*(const M &other) const{
		return M(x*other.x);
	}
	M operator+(const M &other) const{
		return M(x+other.x);
	}
	M operator-(const M &other) const{
		return M(x-other.x);
	}
	M operator-(){
		return M(-x);
	}
};
point plist[205];
vector <pii> urutan;
M pangkat[205],ans;
int fpb(int a,int b){
	if(b==0)
		return a;
	return fpb(b,a%b);
}
pii kecilkan(pii pecah){
	if(pecah.fi==0)
	{
		assert(pecah.se!=0);
		return mp(0,1);
	}
	if(pecah.se==0)
	{
		assert(pecah.fi!=0);
		return mp(1,0);
	}
	int bagi=fpb(abs(pecah.fi),abs(pecah.se));
	pecah.fi/=bagi;
	pecah.se/=bagi;
	if(pecah.fi*pecah.se<0)		//minus selalu di first
	{
		pecah.fi=-abs(pecah.fi);
		pecah.se=abs(pecah.se);
	}
	else
	{
		pecah.fi=abs(pecah.fi);
		pecah.se=abs(pecah.se);
	}
	return pecah;
}
void isipangkat(){
	pangkat[0]=1;
	for(int i=1;i<=n;i++)
		pangkat[i]=pangkat[i-1]*2;
}
void hitungansawal(){
	ans=pangkat[n]-1-n;
}
int main()
{
	scan(n);
	isipangkat();
	hitungansawal();
	for(int i=1;i<=n;i++)
	{
		scan(plist[i].x,plist[i].y);
	}
	//hitung ans modif
	for(int i=1;i<n;i++)
	{
		urutan.clear();
		for(int j=i+1;j<=n;j++)
			urutan.pb(kecilkan(mp(plist[j].x-plist[i].x,plist[j].y-plist[i].y)));
		sort(all(urutan));
		int totalkembar=0;
		pii last=urutan[0];
		for(auto isi:urutan)
		{
			if(isi!=last)
			{
				last=isi;
				ans=ans-(pangkat[totalkembar]-1);
				totalkembar=0;
			}
			totalkembar++;
		}
		ans=ans-(pangkat[totalkembar]-1);
	}
	cout<<ans.x<<endl;
}

Submission Info

Submission Time
Task E - ConvexScore
User Yehezkiel
Language C++14 (GCC 5.4.1)
Score 700
Code Size 2540 Byte
Status AC
Exec Time 3 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 3
AC × 36
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt, 1_031.txt, 1_032.txt, 1_033.txt, 1_034.txt, 1_035.txt
Case Name Status Exec Time Memory
0_000.txt AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 1 ms 256 KB
1_004.txt AC 1 ms 256 KB
1_005.txt AC 2 ms 256 KB
1_006.txt AC 1 ms 256 KB
1_007.txt AC 2 ms 256 KB
1_008.txt AC 2 ms 256 KB
1_009.txt AC 2 ms 256 KB
1_010.txt AC 1 ms 256 KB
1_011.txt AC 2 ms 256 KB
1_012.txt AC 2 ms 256 KB
1_013.txt AC 2 ms 256 KB
1_014.txt AC 1 ms 256 KB
1_015.txt AC 1 ms 256 KB
1_016.txt AC 1 ms 256 KB
1_017.txt AC 3 ms 256 KB
1_018.txt AC 3 ms 256 KB
1_019.txt AC 3 ms 256 KB
1_020.txt AC 3 ms 256 KB
1_021.txt AC 3 ms 256 KB
1_022.txt AC 3 ms 256 KB
1_023.txt AC 3 ms 256 KB
1_024.txt AC 2 ms 256 KB
1_025.txt AC 2 ms 256 KB
1_026.txt AC 2 ms 256 KB
1_027.txt AC 1 ms 256 KB
1_028.txt AC 1 ms 256 KB
1_029.txt AC 3 ms 256 KB
1_030.txt AC 3 ms 256 KB
1_031.txt AC 3 ms 256 KB
1_032.txt AC 3 ms 256 KB
1_033.txt AC 3 ms 256 KB
1_034.txt AC 3 ms 256 KB
1_035.txt AC 3 ms 256 KB