結果
問題 | No.883 ぬりえ |
ユーザー | ganariya |
提出日時 | 2019-09-15 20:15:41 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 5,410 bytes |
コンパイル時間 | 1,438 ms |
コンパイル使用メモリ | 144,928 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 22:50:04 |
合計ジャッジ時間 | 5,088 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
ソースコード
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <unordered_map> #include <climits> #include <set> #include <unordered_set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <queue> #include <random> #include <complex> #include <regex> #include <locale> #include <random> #include <type_traits> using namespace std; #define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";} #define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}} using LL = long long; //------------------------------------------ //------------------------------------------ template<uint_fast64_t Modulas = 1000000007ul> class ModInt { using u64 = uint_fast64_t; public: u64 x; constexpr ModInt() : x(0) {} constexpr ModInt(const u64 x) : x(x % Modulas) {} constexpr ModInt operator+(const ModInt rhs) const noexcept { return ModInt(*this) += rhs; } constexpr ModInt operator-(const ModInt rhs) const noexcept { return ModInt(*this) -= rhs; } constexpr ModInt operator*(const ModInt rhs) const noexcept { return ModInt(*this) *= rhs; } constexpr ModInt operator/(const ModInt rhs) const noexcept { return ModInt(*this) /= rhs; } constexpr ModInt operator/(const long long rhs) const noexcept { return ModInt(*this) /= rhs; } constexpr ModInt operator+=(const ModInt rhs) noexcept { x += rhs.x; if (x >= Modulas) x -= Modulas; return *this; } constexpr ModInt operator+=(const long long rhs) noexcept { auto hs = ModInt<Modulas>(rhs); (*this) += hs; return *this; } constexpr ModInt operator-=(const ModInt rhs) noexcept { if (x < rhs.x) x += Modulas; x -= rhs.x; return *this; } constexpr ModInt operator-=(const long long rhs) noexcept { auto hs = ModInt<Modulas>(rhs); (*this) -= hs; return *this; } constexpr ModInt operator*=(const ModInt rhs) noexcept { x = x * rhs.x % Modulas; return *this; } constexpr ModInt operator*=(const long long rhs) noexcept { auto hs = ModInt<Modulas>(rhs); (*this) *= hs; return *this; } constexpr ModInt &operator/=(ModInt rhs) noexcept { u64 exp = Modulas - 2; while (exp > 0) { if (exp & 1ul) *this *= rhs; rhs *= rhs; exp >>= 1ul; } return *this; } constexpr ModInt &operator/=(long long rhs) noexcept { auto hs = ModInt<Modulas>(rhs); (*this) /= hs; return *this; } constexpr ModInt &operator++() noexcept { x++; if (x >= Modulas) x -= Modulas; return *this; } constexpr ModInt &operator--() noexcept { if (x == 0) x += Modulas; x--; return *this; } constexpr bool operator<(const ModInt rhs) const noexcept { return x < rhs.x; } constexpr bool operator==(const ModInt rhs) const noexcept { return this->x == rhs.x; } constexpr bool operator!=(const ModInt rhs) const noexcept { return !(*this == rhs); } friend istream &operator>>(istream &in, ModInt &m) { in >> m.x; m.x %= Modulas; return in; } friend ostream &operator<<(ostream &out, const ModInt &p) { out << p.x; return out; } constexpr ModInt pow(u64 p) const { ModInt ret(1); ModInt mul(x); while (p > 0) { if (p & 1ul) ret *= mul; mul *= mul; p >>= 1ul; } return ret; } constexpr ModInt operator~() const noexcept { u64 exp = Modulas - 2; return pow(exp); } constexpr static ModInt arith_sum(ModInt<Modulas> a, ModInt<Modulas> d, ModInt<Modulas> n) noexcept { return (a * ModInt<Modulas>(2) + (n - 1) * d) * n / ModInt<Modulas>(2); } }; int main() { LL N, K; cin >> N >> K; if (N <= K * K) { for (LL m = 1; m <= K; m++) { if (m * m >= N) { vector<string> S(m, string(m, '.')); for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { if (N > 0) { N--; S[i][j] = '#'; } } } for (int i = 0; i < m; i++) cout << S[i] << endl; return 0; } } } for (LL m = 1;; m++) { if (K * m >= N) { vector<string> S(m, string(m, '.')); for (int i = 0; i < m; i++) { for (int j = 0; j < K; j++) { if (N > 0) S[i][(i + j) % m] = '#', N--; } } for (int i = 0; i < m; i++) cout << S[i] << endl; return 0; } } return 0; }