Submission #468382

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4683822021-08-27 22:41:03thomas_liFancy Fence (CEOI20_fancyfence)C++17
100 / 100
107 ms4952 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
template <class T, class U> T pow2(T base, U pow) {
T x = 1; while (true) {
if (pow % 2 == 1) x = x * base;
if ((pow /= 2) == 0) break;
base = base * base;
}
return x;
}
template <class T> constexpr bool isPrime(T x) {
if (x < 2) return false;
for (T i = 2; i * i <= x; i++) if (x % i == 0) return false;
return true;
}
template <class T, const T MOD,
#if __cplusplus < 201402L
const bool PRIME_MOD,
#else
const bool PRIME_MOD = isPrime(MOD),
#endif
const bool MUL_OVERFLOW = (numeric_limits<T>::max() / MOD < MOD)>
struct IntMod {
static_assert(is_integral<T>::value, "T must be an integral type");
static_assert(is_signed<T>::value, "T must be a signed type");
static_assert(0 < MOD, "MOD must be a positive integer");
using IM = IntMod<T, MOD, PRIME_MOD, MUL_OVERFLOW>;
T v; IntMod() : v(0) {}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...