結果
| 問題 | No.550 夏休みの思い出(1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-28 22:54:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,348 bytes |
| 記録 | |
| コンパイル時間 | 788 ms |
| コンパイル使用メモリ | 80,896 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-10 04:15:36 |
| 合計ジャッジ時間 | 2,257 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | WA * 55 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
constexpr int MOD = 100003;
struct modint {
int n;
modint(int n = 0) : n(n) {}
};
modint operator+(modint a, modint b) { return modint((a.n += b.n) >= MOD ? a.n - MOD : a.n); }
modint operator-(modint a, modint b) { return modint((a.n -= b.n) < 0 ? a.n + MOD : a.n); }
modint operator*(modint a, modint b) { return modint(1LL * a.n * b.n % MOD); }
modint &operator+=(modint &a, modint b) { return a = a + b; }
modint &operator-=(modint &a, modint b) { return a = a - b; }
modint &operator*=(modint &a, modint b) { return a = a * b; }
int main() {
long long a, b, c;
std::cin >> a >> b >> c;
std::vector<bool> check(MOD);
for (int i = 0; i < MOD; i++) {
modint x = i;
if ((x * x * x + a * x * x + b * x + c).n == 0) {
check[i] = true;
}
}
std::set<long long> ans;
for (long long i = 0; i < MOD; i++) {
if (!check[i]) continue;
for (long long j = i; j <= 1000000000; j += MOD) {
__int128 x = j;
__int128 y = -x;
if (x * x * x + a * x * x + b * x + c == 0) ans.insert(x);
if (y * y * y + a * y * y + b * y + c == 0) ans.insert(y);
}
}
for (long long x : ans) {
std::cout << x << ' ';
}
}