結果
| 問題 |
No.466 ジオラマ
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-06-22 10:46:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,980 bytes |
| コンパイル時間 | 1,460 ms |
| コンパイル使用メモリ | 163,728 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-06-22 10:46:20 |
| 合計ジャッジ時間 | 13,135 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 83 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:2:25: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
2 | # define FILE(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
main.cpp:7:5: note: in expansion of macro ‘FILE’
7 | FILE("hometown");
| ^~~~
main.cpp:2:54: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
2 | # define FILE(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:7:5: note: in expansion of macro ‘FILE’
7 | FILE("hometown");
| ^~~~
ソースコード
# include <bits/stdc++.h>
# define FILE(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);
using namespace std;
int a, b, c, d, n, m;
int main()
{
FILE("hometown");
cin >> a >> b >> c >> d;
if (a == b && a == c)
{
if (c > d || c == 1)
{
cout << -1;
return 0;
}
cout << c << ' ' << c << '\n';
for (int i = 0; i < c; i ++)
{
cout << i << ' ' << (i + 1) % c << '\n';
}
}
else if (a == c)
{
b --;
if (b > d)
{
cout << -1;
return 0;
}
cout << b + 1 << ' ' << b << '\n';
cout << 1 << ' ' << 0 << '\n';
int cnt = 0;
for (int i = 1; i <= b - c; i ++)
{
cout << 1 << ' ' << ++ cnt << '\n';
}
for (int i = 1; i < c; i ++)
{
cout << 0 << ' ' << ++ cnt << '\n';
}
}
else if (b == c)
{
a --;
if (a > d)
{
cout << -1;
return 0;
}
cout << a + 1 << ' ' << a << '\n';
cout << "0 1\n";
int cnt = 0;
for (int i = 1; i <= a - c; i ++) cout << 0 << ' ' << ++ cnt << '\n';
for (int i = 1; i < c; i ++) cout << 1 << ' ' << ++ cnt << '\n';
}
else
{
a --, b --;
n = a + b - c + 2;
m = a + b - 2 * c + (c ? c + 1 : 0);
if (m > d)
{
cout << -1;
return 0;
}
cout << n << ' ' << m << '\n';
int cnt = 0;
for (int i = 1; i <= a - c; i ++) cout << 0 << ' ' << ++ cnt << '\n';
for (int i = 1; i <= b - c; i ++) cout << 1 << ' ' << ++ cnt << '\n';
if (!c) return 0;
int rt = ++ cnt;
cout << 0 << ' ' << rt << '\n';
cout << 1 << ' ' << rt << '\n';
for (int i = 1; i < c; i ++)
{
cout << rt << ' ' << ++ cnt << '\n';
}
}
return 0;
}
vjudge1