1299B - Aerodynamic - CodeForces Solution


geometry *1800

Please click on ads to support us..

C++ Code:

/*
________                               _____.___.           .___            
\______ \   ____   ____ ______  __ __  \__  |   |____     __| _/____ ___  __
 |    |  \_/ __ \_/ __ \\____ \|  |  \  /   |   \__  \   / __ |\__  \\  \/ /
 |    `   \  ___/\  ___/|  |_> >  |  /  \____   |/ __ \_/ /_/ | / __ \\   / 
/_______  /\___  >\___  >   __/|____/   / ______(____  /\____ |(____  /\_/  
        \/     \/     \/|__|            \/           \/      \/     \/      
*/


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;

// Macros definition
#define ll long long
#define lld long double
#define ln cout<<"\n"
#define print(a) cout<< a << ' '
#define inf 1e18


typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// x.find_by_order(1) -> return pointer to element present at index 1
// x.order_of_key(2) -> return index of element 2
// other functions of set works fine

// Predefined values
const ll mod = 1e9+7;

void solve(){
    ll n;
    cin>>n;
    vector<ll>x(n), y(n);
    for(int i=0; i<n; i++){
        cin>>x[i]>>y[i];
    }
    if(n%2){
        print("NO");
        return;
    }

    int x0 = x[0]+x[n/2];
    int y0 = y[0]+y[n/2];

    for(int i=0; i<n/2; i++){
        if(x[i] != x0-x[i+n/2] || y0 != y[i]+y[i+n/2]){
            print("NO");return;
        }
    }

    print("YES");
}

int main(){
	
	// Deepu Yadav
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Comments

Submit
0 Comments
More Questions

Zoos
Build a graph
Almost correct bracket sequence
Count of integers
Differences of the permutations
Doctor's Secret
Back to School
I am Easy
Teddy and Tweety
Partitioning binary strings
Special sets
Smallest chosen word
Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!