Tue, 06 Oct 2020 13:08:31 +0800
parent
34976d9667
commit
2db6541c72
@ -0,0 +1,90 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
int T, n, k, x;
|
||||
read(T);
|
||||
while (T--)
|
||||
{
|
||||
read(n, k);
|
||||
priority_queue<int, vector<int>, greater<int>> Q;
|
||||
for (int i = 0; i < n; i++) read(x), Q.push(x);
|
||||
int cnt = 0;
|
||||
while (Q.size() > 1)
|
||||
{
|
||||
int m1 = Q.top();
|
||||
Q.pop();
|
||||
int m2 = Q.top();
|
||||
Q.pop();
|
||||
if (m1 + m2 > k) break;
|
||||
Q.push(m1 + m2);
|
||||
Q.push(m1);
|
||||
cnt++;
|
||||
}
|
||||
printf("%d\n", cnt);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
const int N = 1e5 + 50;
|
||||
int a[N];
|
||||
int main()
|
||||
{
|
||||
int T, n, k;
|
||||
read(T);
|
||||
while (T--)
|
||||
{
|
||||
read(n, k);
|
||||
for (int i = 0; i < n; i++) read(a[i]);
|
||||
int ans = 0;
|
||||
int f = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (a[i] * 2 < k) printf("1 ");
|
||||
if (a[i] * 2 > k) printf("0 ");
|
||||
if (a[i] * 2 == k) printf("%d ", f ^= 1);
|
||||
}
|
||||
puts("");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
project(cf1417)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
if(MSVC)
|
||||
add_compile_options("/Zc:__cplusplus")
|
||||
endif()
|
||||
include_directories("D:\\PortableApps\\MSYS2\\mingw64\\include\\c++\\10.2.0\\x86_64-w64-mingw32")
|
||||
add_executable(A A.cpp)
|
||||
add_executable(B B.cpp)
|
||||
add_executable(C C.cpp)
|
||||
add_executable(D D.cpp)
|
||||
@ -0,0 +1,70 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
project(cf1425)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
if(MSVC)
|
||||
add_compile_options("/Zc:__cplusplus")
|
||||
endif()
|
||||
include_directories("D:\\PortableApps\\MSYS2\\mingw64\\include\\c++\\10.2.0\\x86_64-w64-mingw32")
|
||||
add_executable(A A.cpp)
|
||||
add_executable(B B.cpp)
|
||||
add_executable(C C.cpp)
|
||||
add_executable(D D.cpp)
|
||||
add_executable(E E.cpp)
|
||||
add_executable(F F.cpp)
|
||||
add_executable(G G.cpp)
|
||||
add_executable(H H.cpp)
|
||||
add_executable(I I.cpp)
|
||||
@ -0,0 +1,70 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
const int N = 1e3 + 50;
|
||||
int ans[N];
|
||||
int fans[N];
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d", &n);
|
||||
for (int i = 1; i < n; i++)
|
||||
{
|
||||
printf("? %d %d\n", i, n);
|
||||
fflush(stdout);
|
||||
scanf("%d", ans + i);
|
||||
}
|
||||
for (int i = 0; i < n - 2; i++)
|
||||
fans[i] = ans[i + 1] - ans[i + 2];
|
||||
printf("? %d %d\n", 1, n - 1);
|
||||
fflush(stdout);
|
||||
int x;
|
||||
scanf("%d", &x);
|
||||
int sum1 = accumulate(fans, fans + n - 2, 0);
|
||||
fans[n - 2] = x - sum1;
|
||||
fans[n - 1] = ans[1] - sum1 - fans[n - 2];
|
||||
printf("!");
|
||||
for (int i = 0; i < n; i++) printf(" %d", fans[i]);
|
||||
puts("");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
char *ans[] = {"Tidak", "Ya"};
|
||||
int main()
|
||||
{
|
||||
int T, a, b, c, d;
|
||||
read(T);
|
||||
while (T--)
|
||||
{
|
||||
read(a, b, c, d);
|
||||
c += b, d += a;
|
||||
if ((a + b) & 1) //neg
|
||||
printf("%s %s Tidak Tidak\n", ans[!!d], ans[!!c]);
|
||||
else //pos
|
||||
printf("Tidak Tidak %s %s\n", ans[!!c], ans[!!d]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
const int N = 105;
|
||||
int a[N], b[N], c[N];
|
||||
int main()
|
||||
{
|
||||
int T, n;
|
||||
read(T);
|
||||
while (T--)
|
||||
{
|
||||
read(n);
|
||||
for (int i = 0; i < n; i++) read(a[i]);
|
||||
for (int i = 0; i < n; i++) read(b[i]);
|
||||
for (int i = 0; i < n; i++) read(c[i]);
|
||||
int last = -1;
|
||||
for (int i = 0; i < n - 1; i++)
|
||||
{
|
||||
if (a[i] == last)
|
||||
printf("%d ", last = b[i]);
|
||||
else
|
||||
printf("%d ", last = a[i]);
|
||||
}
|
||||
if (a[n - 1] != last && a[n - 1] != a[0])
|
||||
printf("%d\n", a[n - 1]);
|
||||
else if (b[n - 1] != last && b[n - 1] != a[0])
|
||||
printf("%d\n", b[n - 1]);
|
||||
else
|
||||
printf("%d\n", c[n - 1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
int a[105];
|
||||
int main()
|
||||
{
|
||||
int T, n, k;
|
||||
read(T);
|
||||
while (T--)
|
||||
{
|
||||
read(n, k);
|
||||
for (int i = 0; i < n; i++) read(a[i]);
|
||||
sort(a, a + n);
|
||||
int l = unique(a, a + n) - a;
|
||||
if (l != 1 && k == 1)
|
||||
puts("-1");
|
||||
else if (l == 1)
|
||||
puts("1");
|
||||
else
|
||||
printf("%d\n", (l - 1 + k - 2) / (k - 1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
const int N = 1e5 + 50;
|
||||
double ta[N], tb[N];
|
||||
int p[N];
|
||||
int main()
|
||||
{
|
||||
int T, n, len;
|
||||
read(T);
|
||||
while (T--)
|
||||
{
|
||||
read(n, len);
|
||||
for (int i = 1; i <= n; i++) read(p[i]);
|
||||
p[n + 1] = len;
|
||||
tb[n + 1] = 0;
|
||||
for (int i = 1, curspeed = 1; i <= n + 1; i++)
|
||||
{
|
||||
ta[i] = ta[i - 1] + 1.0 * (p[i] - p[i - 1]) / curspeed;
|
||||
curspeed++;
|
||||
}
|
||||
for (int i = n, curspeed = 1; i >= 0; i--)
|
||||
{
|
||||
tb[i] = tb[i + 1] + 1.0 * (p[i + 1] - p[i]) / curspeed;
|
||||
curspeed++;
|
||||
}
|
||||
for (int i = 0; i <= n + 1; i++)
|
||||
if (ta[i] > tb[i])
|
||||
{
|
||||
i--;
|
||||
double ans = 0;
|
||||
double dis = p[i + 1] - p[i];
|
||||
if (ta[i] > tb[i + 1])
|
||||
{
|
||||
ans += ta[i];
|
||||
dis -= abs(ta[i] - tb[i + 1]) * (n - i + 1);
|
||||
ans += dis / (n + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
ans += tb[i + 1];
|
||||
dis -= abs(ta[i] - tb[i + 1]) * (i + 1);
|
||||
ans += dis / (n + 2);
|
||||
}
|
||||
printf("%.15lf\n", ans);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
struct node
|
||||
{
|
||||
int type;
|
||||
union
|
||||
{
|
||||
char s[10];
|
||||
int v;
|
||||
};
|
||||
};
|
||||
int cmp(const list<node> &s1, const list<node> &s2)
|
||||
{
|
||||
}
|
||||
list<node> build(char *buf)
|
||||
{
|
||||
list<node> r;
|
||||
for (char *p = buf; *p; p++)
|
||||
{
|
||||
|
||||
}
|
||||
return r;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
read(n);
|
||||
char buf[16];
|
||||
scanf("%s", buf);
|
||||
auto s0 = build(buf);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
scanf("%s", buf);
|
||||
if (cmp(build(buf), s0))
|
||||
puts("+");
|
||||
else
|
||||
puts("-");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
import re
|
||||
|
||||
|
||||
def proc(l):
|
||||
r = []
|
||||
for v in l:
|
||||
if v.isdigit():
|
||||
r.append(int(v))
|
||||
else:
|
||||
for ch in v:
|
||||
r.append(10**10 + ord(ch))
|
||||
r.append(-1)
|
||||
return r
|
||||
|
||||
|
||||
def cmp(a, b):
|
||||
for i, j in zip(a, b):
|
||||
if i < j:
|
||||
return True
|
||||
if i > j:
|
||||
return False
|
||||
|
||||
|
||||
spl = re.compile(r'(\d+|[a-zA-Z]+)')
|
||||
n = int(input())
|
||||
s0 = proc(spl.findall(input()))
|
||||
for i in range(n):
|
||||
s = proc(spl.findall(input()))
|
||||
if cmp(s, s0):
|
||||
print('-')
|
||||
else:
|
||||
print('+')
|
||||
@ -0,0 +1,88 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define CRP(t, x) const t &x
|
||||
#define OPX(op, t, x) operator op(CRP(t, x))
|
||||
#define OPL(t, x) bool OPX(<, t, x) const
|
||||
#define FIL(x, v) memset(x, v, sizeof(x))
|
||||
#define CLR(x) FIL(x, 0)
|
||||
#define NE1(x) FIL(x, -1)
|
||||
#define INF(x) FIL(x, 0x3f)
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG 0
|
||||
#endif // !_DEBUG
|
||||
#define IFD if (_DEBUG)
|
||||
typedef int64_t ll, i64;
|
||||
typedef uint64_t ull, u64;
|
||||
template <typename... Types>
|
||||
using comtype = typename common_type<Types...>::type;
|
||||
template <typename T>
|
||||
using enable_if_arithmetic = typename enable_if<is_arithmetic<T>::value>::type;
|
||||
template <typename T>
|
||||
using enable_if_integral = typename enable_if<is_integral<T>::value>::type;
|
||||
inline char getchar(int)
|
||||
{
|
||||
static char buf[64 << 20], *S = buf, *T = buf;
|
||||
if (S == T) T = fread(S = buf, 1, 64 << 20, stdin) + buf;
|
||||
return S == T ? EOF : *S++;
|
||||
}
|
||||
template <typename T, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x)
|
||||
{
|
||||
int ch = x = 0, f = 1;
|
||||
while (!isdigit(ch = getchar()))
|
||||
if (ch == EOF)
|
||||
return false;
|
||||
else if (ch == '-')
|
||||
f = 0;
|
||||
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
|
||||
return x = f ? x : -x, true;
|
||||
}
|
||||
template <typename T, typename... Args, typename = enable_if_integral<T>>
|
||||
inline bool read(T &x, Args &... args) { return read(x) && read(args...); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmin(CRP(T1, v1), CRP(T2, v2)) { return min<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmin(CRP(T, v), const Args &... args) { return min<TResult>(v, mmin(args...)); }
|
||||
template <typename T1, typename T2, typename TResult = comtype<T1, T2>>
|
||||
inline TResult mmax(CRP(T1, v1), CRP(T2, v2)) { return max<TResult>(v1, v2); }
|
||||
template <typename T, typename... Args, typename TResult = comtype<T, Args...>>
|
||||
inline TResult mmax(CRP(T, v), const Args &... args) { return max<TResult>(v, mmax(args...)); }
|
||||
inline ll gcd(ll a, ll b)
|
||||
{
|
||||
for (; b; swap(a, b)) a %= b;
|
||||
return a;
|
||||
}
|
||||
inline ll fpow(ll a, ll b, ll m)
|
||||
{
|
||||
ll r = 1;
|
||||
for (; b; b >>= 1, a = a * a % m)
|
||||
if (b & 1) r = r * a % m;
|
||||
return r;
|
||||
}
|
||||
constexpr double eps = 1e-8;
|
||||
inline int sgn(double x) { return x > eps ? 1 : x < -eps ? -1 : 0; }
|
||||
const int N = 1e5 + 50;
|
||||
pair<int, int> a[N];
|
||||
int b[N << 1];
|
||||
int presum[N << 1];
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
read(n);
|
||||
for (int i = 0; i < n; i++)
|
||||
read(a[i].first, a[i].second), b[i << 1] = a[i].first, b[i << 1 | 1] = a[i].second;
|
||||
sort(b, b + n + n);
|
||||
auto be = unique(b, b + n + n);
|
||||
for (int i = 0; i < n; i++)
|
||||
a[i].first = lower_bound(b, be, a[i].first) - b + 1,
|
||||
a[i].second = lower_bound(b, be, a[i].second) - b + 1;
|
||||
for (int i = 0; i < n; i++)
|
||||
presum[a[i].first]++, presum[a[i].second]--;
|
||||
for (int i = 1; i <= be - b; i++)
|
||||
presum[i] += presum[i - 1];
|
||||
auto maxp = max_element(presum, presum + (be - b) + 1);
|
||||
printf("%d %d", b[maxp - presum - 1], *maxp);
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
project(nowcoder7831)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
if(MSVC)
|
||||
add_compile_options("/Zc:__cplusplus")
|
||||
endif()
|
||||
include_directories("D:\\PortableApps\\MSYS2\\mingw64\\include\\c++\\10.2.0\\x86_64-w64-mingw32")
|
||||
add_executable(B B.cpp)
|
||||
@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup />
|
||||
<ItemGroup />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
<RuntimeLibrary Condition="'$(Configuration)'=='Release'">MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeLibrary Condition="'$(Configuration)'=='Debug'">MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<PropertyGroup>
|
||||
<IncludePath>D:\PortableApps\MSYS2\mingw64\include\c++\10.2.0\x86_64-w64-mingw32;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
|
||||
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
|
||||
<ProjectGuid>{AFFB95BF-30B4-4DFB-B1F1-98F24D67BD64}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<ClCompile Include="B.cpp" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Reference in new issue