Submission #67704863
Source Code Expand
/* Pre-Processing */
#include <bits/stdc++.h>
#define Made_By_Karimskee ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cin(vec) for(auto &it : vec) cin >> it
#define PI 3.14159265359
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
void test_cases()
{
ll n; cin >> n;
vector<ll> vec(n);
cin(vec);
ll x;
cin >> x;
for (auto it : vec)
{
if (it == x)
{
cout << "Yes";
return;
}
}
cout << "No";
}
int main()
{
Made_By_Karimskee
ll t = 1;
// cin >> t;
while (t--) test_cases();
}
/*
*/
/** To know
* Method to get x from y:
* 4 from [4, 5, 6, 7]
* 8 from [8, 9, 10, 11, 12, 13, 14, 15]
* probably using bitmask
*/
/** Methods
* Prefix sum -> calculate the sum for each query from l to r
* Partial sum / Ranged sum -> add x for each query from l to r
*
* lower_bound() -> binary search
* upper_bound() -> binary search
*/
/** Functions
* string timeStr = "start:14:30:25";
* char start[10];
* int h1, m1, s1;
* sscanf(timeStr.c_str(), "%[^:]:%d:%d:%d",
* start, &h1, &m1, &s1);
* string startLabel = start;
*
* freopen("input.txt", "r", stdin);
* freopen("output.txt", "w", stdout);
*/
/** Don't forget
* lower_bound(vec.begin(), vec.end(), x) -> binary search in a sorted sequence for a value >= x
* upper_bound(vec.begin(), vec.end(), x) -> binary search in a sorted sequence for a value > x
* equal_range(vec.begin(), vec.end(), x) -> returns a pair of (lower_bound, upper_bound)
*
* logu(x) = logk(x) / logk(u)
*
* Time complexity:
* In codeforces, 1 second is:
* 10^8 of simple operations ([], +, >>, *, ^, ...)
* 10^6 of slower operations (I/O, hashmap lookup, ...)
*
* n <= 10 O(n!) -> all permutations
* n <= 20 O(2^n) -> all subsets
* n <= 500 O(n^3) -> all triplets
* n <= 5000 O(n^2) -> all pairs
* n <= 10^6 O(nlogn) or O(n) -> can sort if O(nlogn), all elements if O(n)
* n is larger O(1) or O(logn) -> no iterations
*
* comparison operator:
* struct P # Now you can sort two elements of P as normal variables
* {
* int x, y;
* bool operator<(const P &p)
* {
* if (x != p.x) return x < p.x;
* else return y < p.y;
* }
* };
* bool comp(string a, string b) # You will need to pass comp to the sort function
* {
* if (a.size() != b.size()) return a.size() < b.size();
* return a < b;
* }
*/
/* Functions */
/* Arithmetic Progression: 3 5 8 11 */
/**
* @param First_element @param Last_element @param Sequence_length
* @return The summation of the sequence
*/
ll arithmetic_progression_sum(ll a1, ll an, ll n)
{
return (a1 + an) * n / 2;
}
/**
* @param First_element @param Sequence_length @param Difference
* @return The last element of the sequence
*/
ll arithmetic_progression_last_element(ll a1, ll n, ll d)
{
return a1 + (n - 1) * d;
}
/* /Arithmetic Progression: 3 5 8 11 */
/* Geometric Progression 1 2 4 8 16 */
/**
* @param First_element @param Sequence_length @param Ratio
* @return The summation of the sequence
*/
double geometric_progression_sum(ll a1, ll n, ll r)
{
return a1 * (1 - pow(r, n)) / (1 - r);
}
/**
* @param First_element @param Sequence_length @param Ratio
* @return The last element of the sequence
*/
double geometric_progression_last_element(ll a1, ll n, ll r)
{
return a1 * pow(r, n - 1);
}
/* /Geometric Progression 1 2 4 8 16 */
/* Power Sum 1^3 + 2^3 + 3^3 + 4^^4 + ... */
/**
* @param sequence_length @param exponent
* @return Returns: 1^k + 2^k + 3^k + ... + n^k
*/
ll power_sum(ll n, ll k)
{
if (k == 1) return n * (n + 1) / 2;
if (k == 2) return n * (n + 1) * (2 * n + 1) / 6;
if (k == 3) { ll s = n * (n + 1) / 2; return s * s; }
if (k == 4) return n * (n + 1) * (2 * n + 1) * (3 * n * n + 3 * n - 1) / 30;
if (k == 5) return n * n * (n + 1) * (n + 1) * (2 * n * n + 2 * n - 1) / 12;
return -1;
}
/* /Power Sum 1^3 + 2^3 + 3^3 + 4^^4 + ... */
/* Maths */
/**
* @brief Accurate for n <= 70 due to floating point precision
* @param nth_fibonacci_number
* @return Returns the nth Fibonacci number
*/
ll fibonacci(ll n)
{
double sqrt5 = sqrt(5), phi = (1 + sqrt5) / 2, psi = (1 - sqrt5) / 2;
return llround((pow(phi, n) - pow(psi, n)) / sqrt5);
}
/**
* @param number_in_decimal @param number_base
* @return number of digits in (number)_base
*/
ll number_of_digits(ll number, ll base)
{
if (number == 0) return 1;
return floor(log(number) / log(base)) + 1;
}
/* Fast mathmatical operations */
/**
* @param product
* @return floor(log2(n))
*/
double fast_log2(ll product)
{
return 63 - __builtin_clzll(product);
}
/**
* @param exponent
* @return pow(2, n)
*/
ll fast_pow(ll base, ll exponent)
{
ll result = 1;
while (exponent > 0)
{
if (exponent & 1)
result = (result * base);
base *= base;
exponent >>= 1;
}
return result;
}
/* /Fast Mathmatical Operations */
/* /Maths */
/* Type Checkers */
/**
* @param Number
* @return True if float or double, False otherwise
*/
bool is_integral(double n)
{
return floor(n) == n;
}
/* /Type Checkers */
/* /Functions */
Submission Info
| Submission Time |
|
| Task |
A - Unsupported Type |
| User |
Karimskee |
| Language |
C++ 20 (gcc 12.2) |
| Score |
100 |
| Code Size |
5669 Byte |
| Status |
AC |
| Exec Time |
1 ms |
| Memory |
3584 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
100 / 100 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
sample_01.txt, sample_02.txt, sample_03.txt |
| All |
sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt |
| Case Name |
Status |
Exec Time |
Memory |
| sample_01.txt |
AC |
1 ms |
3452 KiB |
| sample_02.txt |
AC |
1 ms |
3456 KiB |
| sample_03.txt |
AC |
1 ms |
3420 KiB |
| test_01.txt |
AC |
1 ms |
3388 KiB |
| test_02.txt |
AC |
1 ms |
3424 KiB |
| test_03.txt |
AC |
1 ms |
3584 KiB |
| test_04.txt |
AC |
1 ms |
3420 KiB |
| test_05.txt |
AC |
1 ms |
3500 KiB |
| test_06.txt |
AC |
1 ms |
3460 KiB |
| test_07.txt |
AC |
1 ms |
3496 KiB |
| test_08.txt |
AC |
1 ms |
3516 KiB |
| test_09.txt |
AC |
1 ms |
3524 KiB |
| test_10.txt |
AC |
1 ms |
3456 KiB |
| test_11.txt |
AC |
1 ms |
3436 KiB |
| test_12.txt |
AC |
1 ms |
3516 KiB |
| test_13.txt |
AC |
1 ms |
3456 KiB |
| test_14.txt |
AC |
1 ms |
3456 KiB |
| test_15.txt |
AC |
1 ms |
3508 KiB |
| test_16.txt |
AC |
1 ms |
3460 KiB |
| test_17.txt |
AC |
1 ms |
3584 KiB |
| test_18.txt |
AC |
1 ms |
3460 KiB |
| test_19.txt |
AC |
1 ms |
3584 KiB |
| test_20.txt |
AC |
1 ms |
3452 KiB |
| test_21.txt |
AC |
1 ms |
3488 KiB |
| test_22.txt |
AC |
1 ms |
3464 KiB |