結果
| 問題 |
No.1442 I-wate Shortest Path Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-11 00:03:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 9,813 bytes |
| コンパイル時間 | 1,985 ms |
| コンパイル使用メモリ | 195,312 KB |
| 最終ジャッジ日時 | 2025-01-19 13:22:01 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 25 |
コンパイルメッセージ
main.cpp: In function ‘void Freopen(const char*, const char*)’:
main.cpp:222:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
222 | freopen(in, "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~
main.cpp:223:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
223 | freopen(out, "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~
ソースコード
// Exported by Exporter.exe
// Included from limit_check.cpp
// limit checker
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define MTP make_tuple
#define R Read
#define RD Read_Digit
#define RP Read_P
#define RL Read_Loop
#define RLD Read_Loop_Digit
#define RLP Read_Loop_P
typedef long long int ll;
typedef unsigned long long int ull;
constexpr int kN = int(1E5 + 10);
constexpr int kK = 20;
// constexpr int kMod = 998244353;
// constexpr int kMod = int(1E9 + 7);
// constexpr int kInf = 0x3f3f3f3f;
// constexpr ll kInf = 0x3f3f3f3f3f3f3f3f;
// constexpr double kPi = acos(-1);
// constexpr double kEps = 1E-9;
// Included from C:\Users\ianli\Desktop\CP\template\Various\Fast_IO\Fast_IO.cpp
// --- Get ---
static inline char Get_Raw_Char() {
static char buf[1 << 16], *p = buf, *end = buf;
if (p == end) {
if ((end = buf + fread(buf, 1, 1 << 16, stdin)) == buf) return '\0';
p = buf;
}
return *p++;
}
static inline int Get_Digit() {
char c = Get_Raw_Char();
while (!isdigit(c)) c = Get_Raw_Char();
return int(c - '0');
}
template <typename T> static inline int Get_P() {
static_assert(is_integral<T>::value);
char c = Get_Raw_Char();
while (!isdigit(c)) c = Get_Raw_Char();
T ret = int(c - '0');
while (isdigit(c = Get_Raw_Char())) ret = ret * 10 + int(c - '0');
return ret;
}
template <typename T> static inline int Get() {
static_assert(is_integral<T>::value);
char c = Get_Raw_Char();
bool neg = false;
while (!isdigit(c)) {
if (c == '-') neg = true;
c = Get_Raw_Char();
}
T ret = int(c - '0');
while (isdigit(c = Get_Raw_Char())) ret = ret * 10 + int(c - '0');
if (neg) return -ret;
return ret;
}
// --- Read ---
template <typename T> static inline void Read_P(T &n) {
static_assert(is_integral<T>::value);
char c = Get_Raw_Char();
while (!isdigit(c)) c = Get_Raw_Char();
n = int(c - '0');
while (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0');
return ;
}
template <typename T> static inline void Read(T &n) {
static_assert(is_integral<T>::value);
char c = Get_Raw_Char();
bool neg = false;
while (!isdigit(c)) {
if (c == '-') neg = true;
c = Get_Raw_Char();
}
n = int(c - '0');
while (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0');
if (neg) n = -n;
return ;
}
template <typename T> static inline void Read_Digit(T &n) {
static_assert(is_integral<T>::value);
char c = Get_Raw_Char();
while (!isdigit(c)) c = Get_Raw_Char();
n = int(c - '0');
return ;
}
// --- Read multiple ---
template <typename T, typename... Targs> static inline void Read(T &n, Targs&... Fargs) {
Read(n);
return Read(Fargs...);
}
template <typename T, typename... Targs> static inline void Read_Digit(T &n, Targs&... Fargs) {
Read_Digit(n);
return Read_Digit(Fargs...);
}
template <typename T, typename... Targs> static inline void Read_P(T &n, Targs&... Fargs) {
Read_P(n);
return Read_P(Fargs...);
}
// --- Read Loop ---
template <typename T> static inline void Read_Loop_i(int i, T *a) {return Read(a[i]);}
template <typename T, typename... Targs> static inline void Read_Loop_i(int i, T *a, Targs*... Fargs) {
Read(a[i]);
return Read_Loop_i(i, Fargs...);
}
template <typename... Targs> static inline void Read_Loop(int n, Targs*... Fargs) {
for (int i = 1; i <= n; i++) Read_Loop_i(i, Fargs...);
return ;
}
template <typename T> static inline void Read_Loop_Digit_i(int i, T *a) {return Read_Digit(a[i]);}
template <typename T, typename... Targs> static inline void Read_Loop_Digit_i(int i, T *a, Targs*... Fargs) {
Read_Digit(a[i]);
return Read_Loop_Digit_i(i, Fargs...);
}
template <typename... Targs> static inline void Read_Loop_Digit(int n, Targs*... Fargs) {
for (int i = 1; i <= n; i++) Read_Loop_Digit_i(i, Fargs...);
return ;
}
template <typename T> static inline void Read_Loop_P_i(int i, T *a) {return Read_P(a[i]);}
template <typename T, typename... Targs> static inline void Read_Loop_P_i(int i, T *a, Targs*... Fargs) {
Read_P(a[i]);
return Read_Loop_P_i(i, Fargs...);
}
template <typename... Targs> static inline void Read_Loop_P(int n, Targs*... Fargs) {
for (int i = 1; i <= n; i++) Read_Loop_P_i(i, Fargs...);
return ;
}
// --- Float ---
template <int mul, typename T> static inline void Read(T &n) {
char c = Get_Raw_Char();
bool neg = false;
while (!isdigit(c)) {
if (c == '-') neg = true;
c = Get_Raw_Char();
}
n = int(c - '0');
while (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0');
int cnt = 0;
if (c == '.') {
while (isdigit(c = Get_Raw_Char())) {
n = n * 10 + int(c - '0');
cnt++;
}
}
while (cnt < mul) {
n = n * 10;
cnt++;
}
if (neg) n = -n;
return ;
}
template <int mul, typename T> static inline void Read_P(T &n) {
char c = Get_Raw_Char();
while (!isdigit(c)) c = Get_Raw_Char();
n = int(c - '0');
while (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0');
int cnt = 0;
if (c == '.') {
while (isdigit(c = Get_Raw_Char())) {
n = n * 10 + int(c - '0');
cnt++;
}
}
while (cnt < mul) {
n = n * 10;
cnt++;
}
return ;
}
template <int mul, typename T, typename... Targs> static inline void Read(T &n, Targs&... Fargs) {
Read<mul>(n);
return Read<mul>(Fargs...);
}
template <int mul, typename T, typename... Targs> static inline void Read_P(T &n, Targs&... Fargs) {
Read_P<mul>(n);
return Read_P<mul>(Fargs...);
}
// --- cin, cout ---
void IOS() {
ios::sync_with_stdio(false);
cin.tie(0);
return ;
}
// --- freopen ---
void Freopen(const char *in, const char *out) {
freopen(in, "r", stdin);
freopen(out, "w", stdout);
return ;
}
// --- Output __int128 ---
template <typename T> void Print128(T x) {
if (x < 0) {
printf("-");
x = -x;
}
if (x == 0) printf("0");
else {
static int val[100];
int idx = -1;
while (x) {
val[++idx] = x % 10;
x /= 10;
}
while (idx >= 0) printf("%d", val[idx--]);
}
}
// End of C:\Users\ianli\Desktop\CP\template\Various\Fast_IO\Fast_IO.cpp
// Included from C:\Users\ianli\Desktop\CP\template\Various\Useful_Functions\Useful_Functions.cpp
// --- sort ---
template <typename T> inline void sort(vector<T> &v) {return sort(v.begin(), v.end());}
template <typename T> inline void sort(int n, T *a) {return sort(a + 1, a + n + 1);}
template <typename T> inline void sort_r(vector<T> &v) {return sort(v.begin(), v.end(), greater<T>());}
template <typename T> inline void sort_r(int n, T *a) {return sort(a + 1, a + n + 1, greater<T>());}
// --- Merge ---
template <typename T> inline void Merge_Vec(vector<T> &a, vector<T> &b, vector<T> &c) {
if (c.size() < a.size() + b.size()) c.resize(a.size() + b.size());
merge(a.begin(), a.end(), b.begin(), b.end(), c.begin());
return ;
}
// --- Discrete ---
template <typename T> inline void Discrete(vector<T> &v) {
sort(v);
v.resize(unique(v.begin(), v.end()) - v.begin());
return ;
}
// --- Relabel ---
template <typename T> inline void relabel(int n, T *val, T *dist) {
if (!dist) dist = val;
T *tmp = new T[n + 1];
memcpy(tmp, val, sizeof(T) * (n + 1));
sort(n, tmp);
int sz = unique(tmp + 1, tmp + n + 1) - (tmp + 1);
for (int i = 1; i <= n; i++) dist[i] = lower_bound(tmp + 1, tmp + sz + 1, val[i]) - tmp;
delete [] tmp;
return ;
}
// --- PQ ---
template <typename T> using PQ = priority_queue<T>;
template <typename T> using PQ_R = priority_queue<T, vector<T>, greater<T>>;
// --- misc ---
template <typename T> inline T ABS(T n) {return n >= 0 ? n : -n;}
template <typename T> inline T gcd(T a, T b) {return b ? gcd(b, a % b) : a;}
template <typename T> inline T lcm(T a, T b) {return a * b / gcd(a, b);}
template <typename T> inline T mex(T a, T b) {return (a == 0 || b == 0) ? ((a == 1 || b == 1) ? 2 : 1) : 0;}
template <typename T> inline void chmin(T &a, T b) {
a = min(a, b);
return ;
}
template <typename T> inline void chmax(T &a, T b) {
a = max(a, b);
return ;
}
// --- iterate ---
const inline vector<int> _range(int l, int r) {
vector<int> ret(r - l + 1);
for (int i = 0, val = l; val <= r; val++, i++) ret[i] = val;
return ret;
}
// End of C:\Users\ianli\Desktop\CP\template\Various\Useful_Functions\Useful_Functions.cpp
// Included from C:\Users\ianli\Desktop\CP\template\Various\Debug\Debug.cpp
void print(const int &x) {printf("%d", x);}
void print(const long long int &x) {printf("%lld", x);}
void print(const double &x) {printf("%.20lf", x);}
void print(const char *x) {printf("%s", x);}
void print(const int n, const int *x) {
printf("%d", x[1]); for (int i = 2; i <= n; i++) printf(" %d", x[i]); printf("\n");
return ;
}
void print(const int n, const long long int *x) {
printf("%lld", x[1]); for (int i = 2; i <= n; i++) printf(" %lld", x[i]); printf("\n");
return ;
}
// End of C:\Users\ianli\Desktop\CP\template\Various\Debug\Debug.cpp
int p[kN], m[kN], a[kN], b[kN], c[kN], u[kN], v[kN];
int x[kK][kN];
bitset<kN> used;
int main() {
int n, k; RP(n, k);
RLP(n - 1, a, b, c);
for (int i = 1; i <= k; i++) {
RP(m[i], p[i]);
RLP(m[i], x[i]);
}
int q; RP(q);
RLP(q, u, v);
assert(2 <= n && n <= 100'000);
assert(0 <= k && k <= 10);
for (int i = 1; i < n; i++) assert(1 <= a[i] && a[i] < b[i] && b[i] <= n);
for (int i = 1; i < n; i++) assert(1 <= c[i] && c[i] <= 1'000'000'000);
for (int i = 1; i <= k; i++) assert(2 <= m[i] && m[i] <= n);
{
int sum = 0;
for (int i = 1; i <= k; i++) sum += m[i];
assert(sum <= 100'000);
}
for (int i = 1; i <= k; i++) assert(1 <= p[i] && p[i] <= 1'000'000'000);
for (int i = 1; i <= k; i++) for (int j = 1; j <= m[i]; j++) assert(1 <= x[i][j] && x[i][j] <= n);
for (int i = 1; i <= k; i++) {
used.reset();
for (int j = 1; j <= m[i]; j++) used[x[i][j]] = true;
assert(int(used.count()) == m[i]);
}
for (int i = 1; i <= q; i++) assert(1 <= u[i] && u[i] < v[i] && v[i] <= n);
}
// End of limit_check.cpp