結果

問題 No.743 Segments on a Polygon
ユーザー Joe HattoriJoe Hattori
提出日時 2018-10-07 10:09:42
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 680 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 59,196 KB
実行使用メモリ 12,192 KB
最終ジャッジ日時 2023-08-02 17:59:53
合計ジャッジ時間 7,049 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n,m; cin >> n >> m;
    vector<int> a, b;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int _a, _b; cin >> _a >> _b;
        if (_b < _a) {
            int temp = _a;
            _a = _b;
            _b = temp;
        }
        a.push_back(_a);
        b.push_back(_b);
        for (int k = 0; k < i; k++) {
            if ((a[k] < _a && _a < b[k]) && (a[k] < _b && _b < b[k])) {
                continue;
            }
            if ((a[k] < _a && _a < b[k]) || (a[k] < _b && _b < b[k])) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0