Submission #19723819


Source Code Expand

Copy
// Author:- Pratik Kinger
// Birla Institute of Technology
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll, ll>
#define mii map<pii, ll>
#define f(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define FIO                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(a) (a).begin(), (a).end()
#define fi first
#define si second
#define sz(x) (ll) x.size()
#define endl '\n'
#define mod 1000000007
#define mset(m, v) memset(m, v, sizeof(m))
using namespace std;
const ll MOD = 1000000000 + 7;
ll powermod(ll a, ll b, ll modi)
{
    a %= modi;
    ll res = 1;
    while (b)
    {
        if (b % 2)
        {
            res = (res * a) % modi;
        }
        b /= 2;
        a = (a * a) % modi;
    }
    return res;
}
ll power(ll a, ll b)
{

    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll binarySearch(ll a[], ll low, ll high, ll key)
{
    while (low <= high)
    {
        ll mid = (low + high) / 2;
        if (a[mid] < key)
        {
            low = mid + 1;
        }
        else if (a[mid] > key)
        {
            high = mid - 1;
        }
        else
        {
            return mid;
        }
    }
    return -1;
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}
ll binarytodecimal(string n)
{
    string num = n;
    ll dec_value = 0;

    ll base = 1;

    ll len = num.length();
    for (int i = len - 1; i >= 0; i--)
    {
        if (num[i] == '1')
            dec_value += base;
        base = base * 2;
    }

    return dec_value;
}
string dtb(ll n)
{
    string s = "";
    while (n > 0)
    {
        if (n % 2 == 0)
            s.pb('0');
        else
            s.pb('1');
        n /= 2;
    }
    reverse(all(s));
    return s;
}
vi seive;
void Seive()
{
    const ll maxn = 1e6 + 5;
    seive.resize(maxn);
    f(i, 0, maxn) seive[i] = i;
    for (ll i = 2; i <= maxn; i += 2)
        seive[i] = 2;
    seive[1] = -1;
    seive[0] = -1;
    for (ll i = 3; i <= maxn; i += 2)
        if (i == seive[i])
            for (ll j = i * i; j < maxn; j += i)
                if (seive[j] == j)
                    seive[j] = i;
}
//------------------------------CODE--HERE--------------------------
//----------global--variables-------------------
//------------end-------------------------------
void solve()
{
    int n;
    cin>>n;
    int a[n];
    f(i,0,n)
    {
        cin>>a[i];
    }
    int b[n];
    f(o,0,n)
    {
        cin>>b[i];
    }
    ll sum = 0;
    for(int i = 0; i<n; i++)
    {
        sum += a[i]*b[i];
    }
    if(sum == 0)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
}
//------------------------------
int main()
{
    //FAST INPUT OUTPUT
    FIO;

//INPUT OUTPUT
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

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

Submission Info

Submission Time
Task B - Orthogonality
User its_me_pratik
Language C++ (GCC 9.2.1)
Score 0
Code Size 3472 Byte
Status CE

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:147:16: error: ‘i’ was not declared in this scope
  147 |         cin>>b[i];
      |                ^