We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Geometry
- Points On a Line
- Discussions
Points On a Line
Points On a Line
Sort by
recency
|
47 Discussions
|
Please Login in order to post a comment
!/bin/python3
import math import os import random import re import sys
if name == 'main': n = int(input()) H = [] V = []
My javascript solution (two liner, could easily be one):
int main() { int n,x,y,x1,y1,cx=0,cy=0,flag=0,num; scanf("%d",&n); num=n; while(n--) { if(flag==0) { scanf("%d%d",&x,&y); x1=x; y1=y; flag=1; } else if(flag==1) { scanf("%d%d",&x,&y); if(x==x1) { cx++; } else if(y==y1) { cy++; } } } if(cx==num-1 || cy==num-1) { printf("YES"); } else { printf("NO"); } }