結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
コンテスト
ユーザー ふーらくたる
提出日時 2016-08-10 21:37:35
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 667 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 541 ms
コンパイル使用メモリ 83,308 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2026-05-07 17:16:20
合計ジャッジ時間 1,507 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 13 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:22:22: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
   22 |         cout << x << " " << y << endl;
      |                      ^~~
main.cpp:15:13: note: 'x' was declared here
   15 |         int x, y;
      |             ^
main.cpp:22:29: warning: 'y' may be used uninitialized [-Wmaybe-uninitialized]
   22 |         cout << x << " " << y << endl;
      |                             ^
main.cpp:15:16: note: 'y' was declared here
   15 |         int x, y;
      |                ^

ソースコード

diff #
raw source code

#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