Sort by

recency

|

47 Discussions

|

  • + 0 comments

    !/bin/python3

    import math import os import random import re import sys

    if name == 'main': n = int(input()) H = [] V = []

    for n_itr in range(n):
        xy = input().split()
    
        x = int(xy[0])
    
        y = int(xy[1])
    
        H.append(xy[0])
        V.append(xy[1])
    setH = set(H)
    setV = set(V)
    if len(setH) == 1 or len(setV) == 1:
        print("YES")
    else:
        print("NO")
    
  • + 0 comments

    My javascript solution (two liner, could easily be one):

    function main() {
        const points = Array(+readLine()).fill().map(_ => readLine().split(' ').map(x => +x));
        console.log([0, 1].some(x => points.every((y, _, arr) => y[x] == arr[0][x])) ? 'YES' : 'NO');
    }
    
  • + 1 comment

    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"); } }

  • + 0 comments
    x = []
    y = []
    n = int(input())
    for i in range(n):
        xy = input().split()
        x.append(xy[0])
        y.append(xy[1])
    print ("YES" if (len(set(x)) == 1 or len(set(y)) == 1 ) else "NO")
    
  • + 0 comments
    import math
    import os
    import random
    import re
    import sys
    
    def line(arr_x,arr_y):
        if len(set(arr_x)) == 1:
            return "YES"
        elif len(set(arr_y)) == 1:
            return "YES"
        else:
            return "NO"
        
    if __name__ == '__main__':
        n = int(input())
        arr_x = []
        arr_y = []
        for n_itr in range(n):
            xy = input().split()
            x = int(xy[0])
            y = int(xy[1])
            arr_x.append(x)
            arr_y.append(y)
        print(line(arr_x,arr_y))