結果
| 問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
| コンテスト | |
| ユーザー |
ふーらくたる
|
| 提出日時 | 2016-08-10 21:37:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 667 bytes |
| 記録 | |
| コンパイル時間 | 676 ms |
| コンパイル使用メモリ | 66,672 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-07 08:48:47 |
| 合計ジャッジ時間 | 1,698 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 13 WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:22:29: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
22 | cout << x << " " << y << endl;
| ^
main.cpp:22:22: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized]
22 | cout << x << " " << y << endl;
| ^~~
ソースコード
#include <iostream>
#include <map>
using namespace std;
int main() {
int x1, y1, x2, y2, x3, y3;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
map<int, int> x_counter, y_counter;
x_counter[x1]++; y_counter[y1]++;
x_counter[x2]++; y_counter[y2]++;
x_counter[x3]++; y_counter[y3]++;
if (x_counter.size() == 2 && y_counter.size() == 2) {
int x, y;
for (auto& it : x_counter) {
if (it.second == 1) x = it.first;
}
for (auto& it : y_counter) {
if (it.second == 1) y = it.first;
}
cout << x << " " << y << endl;
} else {
cout << -1 << endl;
}
return 0;
}
ふーらくたる