結果
問題 | No.3029 オイラー標数 |
ユーザー |
|
提出日時 | 2025-02-21 21:30:46 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 761 ms / 2,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 3,618 ms |
コンパイル使用メモリ | 287,376 KB |
実行使用メモリ | 37,888 KB |
最終ジャッジ日時 | 2025-02-21 21:31:13 |
合計ジャッジ時間 | 14,555 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define rep(i,a,b) for(int i=(a);i<(b);i++)#define all(a) begin(a),end(a)#define sz(a) (int)(a).size()typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pii;ll pow_mod(ll a,ll n,ll m){ll res=1;a%=m;while(n){if(n%2)res=res*a%m;a=a*a%m;n/=2;}res%=m;if(res<0)res+=m;return res;}int main(){cin.tie(0)->sync_with_stdio(0);cin.exceptions(cin.failbit);int Q;cin>>Q;set<int>V;set<pii>E;set<pair<int,pii>>F;while(Q--){int a,b,c;cin>>a>>b>>c;V.insert(a);V.insert(b);V.insert(c);E.insert(pii(a,b));E.insert(pii(b,c));E.insert(pii(a,c));F.insert(make_pair(a,pii(b,c)));}cout<<sz(V)-sz(E)+sz(F)<<endl;}