結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー firiexpfiriexp
提出日時 2021-01-22 21:31:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 2,095 bytes
コンパイル時間 890 ms
コンパイル使用メモリ 103,784 KB
最終ジャッジ日時 2025-01-18 03:48:11
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 75
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:44:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   44 |     for (auto &&i : a) scanf("%d", &i);
      |                        ~~~~~^~~~~~~~~~
main.cpp:45:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |     for (auto &&i : b) scanf("%d", &i);
      |                        ~~~~~^~~~~~~~~~
main.cpp:46:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   46 |     for (auto &&i : c) scanf("%d", &i);
      |                        ~~~~~^~~~~~~~~~
main.cpp:47:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   47 |     for (auto &&i : d) scanf("%d", &i);
      |                        ~~~~~^~~~~~~~~~

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
class modint {
static u32 &mod() { static u32 mod_ = 0; return mod_; }
public:
u32 val;
modint(const u32 x = 0) : val(x % M()) {}
u32 &value() noexcept { return val; }
const u32 &value() const noexcept { return val; }
modint operator+(const modint b) const { return modint(*this) += b; }
modint operator-(const modint b) const { return modint(*this) -= b; }
modint operator*(const modint b) const { return modint(*this) *= b; }
modint operator/(const modint b) const { return modint(*this) /= b; }
modint &operator+=(const modint b) { val += b.val; if (val >= M()) val -= M(); return *this; }
modint &operator-=(const modint b) { if (val < b.val) val += M(); val -= b.val; return *this; }
modint &operator*=(const modint b) { val = (u64)val * b.val % M(); return *this; }
modint pow(ll n) const { modint x = *this, r = 1; while(n){ if(n&1) r *= x; x *= x; n >>= 1; } return r; }
modint &operator/=(modint b) { return *this *= b.pow(M()-2); }
static void set_mod(const u32 x) { mod() = x; }
static int M() { return mod(); }
};
using mint = modint;
int main() {
int n, k, m;
cin >> n >> k >> m;
vector<int> a(n), b(n), c(n), d(n);
for (auto &&i : a) scanf("%d", &i);
for (auto &&i : b) scanf("%d", &i);
for (auto &&i : c) scanf("%d", &i);
for (auto &&i : d) scanf("%d", &i);
sort(a.begin(),a.end());
sort(b.begin(),b.end());
sort(c.begin(),c.end());
sort(d.begin(),d.end());
mint::set_mod(m);
mint ans = 0;
for (int i = 0; i < n; ++i) {
int l = min({a[i], b[i], c[i], d[i]}), r = max({a[i], b[i], c[i], d[i]});
ans += mint(r-l).pow(k);
}
cout << ans.val << "\n";
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0