結果

問題 No.3031 曲面の向き付け
ユーザー t98slider
提出日時 2025-02-21 22:55:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 935 bytes
コンパイル時間 4,895 ms
コンパイル使用メモリ 257,016 KB
実行使用メモリ 6,908 KB
最終ジャッジ日時 2025-02-21 22:55:13
合計ジャッジ時間 7,885 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int m;
    cin >> m;
    vector<tuple<int,int,int>> a(m);
    vector<int> ca;
    for(auto &&[A, B, C] : a){
        cin >> A >> B >> C;
        ca.emplace_back(A);
        ca.emplace_back(B);
        ca.emplace_back(C);
    }
    sort(ca.begin(), ca.end());
    ca.erase(unique(ca.begin(), ca.end()), ca.end());
    vector<int> cnt(ca.size());
    for(auto &&[A, B, C] : a){
        A = lower_bound(ca.begin(), ca.end(), A) - ca.begin();
        B = lower_bound(ca.begin(), ca.end(), B) - ca.begin();
        C = lower_bound(ca.begin(), ca.end(), C) - ca.begin();
        cnt[A]++, cnt[B]++, cnt[C]++;
    }
    for(auto &&[A, B, C] : a){
        if(cnt[A] != cnt[B] || cnt[A] != cnt[C]){
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";
}
0