結果
問題 | No.3029 オイラー標数 |
ユーザー |
![]() |
提出日時 | 2025-02-21 22:42:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 838 ms / 2,000 ms |
コード長 | 3,758 bytes |
コンパイル時間 | 2,012 ms |
コンパイル使用メモリ | 177,532 KB |
実行使用メモリ | 38,016 KB |
最終ジャッジ日時 | 2025-02-21 22:42:53 |
合計ジャッジ時間 | 14,993 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#ifndef ONLINE_JUDGE//なんか手元ではデバックモードになって、atcoder上ではデバックモードにならないらしい ABC325Dはこれで通った#define _GLIBCXX_DEBUG//[]で配列外参照をするとエラーにしてくれる。上下のやつがないとTLEになるので注意 ABC311Eのサンプル4のデバックTLEなどに注意#endif//これと上のONLINE JUDGEが絶対必要//★TLEにならないはずなのにTLEになったらオンラインジャッジを消してデバックモードのまま提出をする。#include <bits/stdc++.h>using namespace std;using ll=long long;using ull=unsigned long long;using ld = long double;using Pii=pair<int,int>;using Pll=pair<ll,ll>;using TT=tuple<int,int,int>;#define mPP(a,b) make_pair(a,b)#define mTT(a,b,c) make_tuple(a,b,c)#define rep1(a) for(int i = 0; i < (int)(a); i++)#define rep2(i, a) for(int i = 0; i < (int)(a); i++)#define rep3(i, a, b) for(int i = (int)(a); i < (int)(b); i++)#define rep4(i, a, b, c) for(int i = (int)(a); i < (int)(b); i += c)#define overload4(a, b, c, d, e, ...) e#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)#define rrep(i,n) for(int i = (int)(n)-1; i >= 0; --i)#define RREP(i,advanced,n) for(int i = (int)(n)-1; i >= advanced; --i)#define all(vec) vec.begin(),vec.end()#define rall(vec) vec.rbegin(),vec.rend()#define ALL(a,middle,last) a.begin()+middle,a.begin()+last#define w_np(a) while(next_permutation(a))#define chmax(x,y) x = max(x,y)#define chmin(x,y) x = min(x,y)#define mycin(vec) for(auto &v:vec) cin >> v;#define mycout(vec) for(auto &v:vec) cout << v << " ";#define dame cout<<-1<<endl#define YES cout<<"Yes"<<endl#define YEAH { cout << "Yes" << endl; return 0; }#define NO cout<<"No"<<endl#define YN {cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} // if(ans[i])YN;#define UQ(v) v.erase( unique(all(v)), v.end() );#define MHT(x1,x2,y1,y2) (abs(x1-x2)+abs(y1-y2)) // マンハッタン距離 = |x1-x2|+|y1-y2| 座標の絶対値の和#define YKD(x1,x2,y1,y2) ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) // ユークリッド距離 座標の差の二乗の和// #define YKD(x1,x2,y1,y2) (pow(x1-x2,2) + pow(y1-y2,2)) // でっかい数のとき 数が 1e10 みたいに表記される場合に注意#define displace(vec) rotate(vec.begin(),vec.begin()+1,vec.end()) // abcd -> bcda のように一つ要素をずらす#define DISPLACE(vec,First,Middle,Last) rotate(vec.begin()+First,vec.begin()+Middle,vec.begin()+Last)// ……a[F-1] (( a[F] a[F+1] …… a[M-1] a[M] a[M+1] …… a[L-1] )) a[L]…… -> ……a[F-1] (( a[M] a[M+1] …… a[L-1] …… a[F] a[F+1] …… a[M-1] )) a[L]……template<typename T> using vc = vector<T>;template<class T> using PQ = priority_queue<T, vc<T>>; // 大きい順に取り出すtemplate<class T> using PQ_G = priority_queue<T, vc<T>, greater<T>>; // 小さい順に取り出すll pow2(ll x) { return x * x; };ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }vc<ll> dx = { 1,0,-1,0 };vc<ll> dy = { 0,1,0,-1 };// vc<ll> dx={1,1,0,-1,-1,-1,0,1};// vc<ll> dy={0,1,1,1,0,-1,-1,-1};int INF = 2e9;// ll INF = 2e18;// template<typename T> using US = unordered_set<T>;template<typename T> using US = set<T>;int main(){int q; cin >> q;US<int> v;US<Pii> e;US<TT> f;rep(i,q) {int a[3]; rep(h,3) cin >> a[h];// sort(a,a+3);v.insert(a[0]), v.insert(a[1]), v.insert(a[2]);e.insert({a[0],a[1]}), e.insert({a[0],a[2]}), e.insert({a[1],a[2]});f.insert(mTT(a[0],a[1],a[2]));}cout << (int)(v.size()) - (int)(e.size()) + (int)(f.size()) << endl;}