結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー ふーらくたるふーらくたる
提出日時 2016-08-10 21:37:35
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 667 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 66,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 23:30:55
合計ジャッジ時間 1,413 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 2 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 WA -
testcase_21 AC 2 ms
5,376 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |                      ^~~

ソースコード

diff #

#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;
}
0