Submission #7562455
Source Code Expand
#include <bits/stdc++.h> #include <algorithm> #include <math.h> #include <queue> #include <cstdio> using namespace std; template <class T> using V = vector<T>; template <class S, class T> using P = pair<S, T>; template <class... T> using TP = tuple<T...>; using ll = long long; using db = double; using ldb = long db; using str = string; using vll = V<ll>; using vvll = V<V<ll>>; using vvvll = V<V<V<ll>>>; using pll = P<ll,ll>; using tpll = TP<ll,ll,ll>; using vpll =V<pll>; using vvpll = V<vpll>; using vtpll = V<tpll>; using vst = V<str>; using vch = V<char>; using vvch = V<vch>; using dqll = deque<ll>; using vdqll = V<dqll>; using pqll = priority_queue<ll>; using pqpll = priority_queue<pll>; using vpqll = V<pqll>; using mll = map<ll,ll>; using vmll = V<mll>; #define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++) #define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--) #define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2) #define bgn begin() #define en end() #define SORT(a) sort((a).bgn,(a).en) #define REV(a) reverse((a).bgn,(a).en) #define fi first #define se second #define sz size() #define gcd(a,b) __gcd(a,b) #define co(a) cout<<a<<endl #define pb(a) push_back(a) #define pf(a) push_front(a) #define ba back() #define fr front() #define pob pop_back() #define pof pop_front() #define mp make_pair #define mt make_tuple #define pbmp(a,b) push_back(mp(a,b)) #define subs(a,n) substr(a,n) #define cfs(a) cout<<fixed<<setprecision(a) // /*vvll v(n,vll(m)) n行m列 continue A.erase(A.begin()+i); 配列Aのi番目を消せる std::binary_search(v.bgn,v.en,a); 二分探索 abs(a,b) pow(a,n) to_string stoll auto Iter=lower_bound(v.bgn,v.en,a); v[i]>=aとなる初のv[i] v.insert(lower_bound(v.bgn,v.en,a),b); bを入れられる lower upper co(*Iter) co(Iter-v.bgn) v[i]>=aとなる初のi vvll v(100001,vll(0)); v[a].pb(b); v[b].pb(a); pqll pq; pq.push(ai); pq.top(); pq.pop(); pqpll qu; pll pa; qu.push(mp(ai,i)); pa=qu.top(); priority_queue<ll,vll,greater<ll>> pqg; 昇順 vdqll dq(3); dq[0].pb(1); dq[0].pb(2); dq[0].pf(0); dq[0].fr→0 dq[0].ba→1 dq[0].pof; dq[0].fr→1 while(que.sz) while(!que.empty()) ll a=1,b=2,c=4,xo; xo=a^b^c; if(a^b^c==7)co(xo)→なし(miss) if(xo==7)co(xo)→7 a<<b→a*2^b a>>b→a/2^b rep(i,1<<20)rep(j,20)if((i>>j)&1)→iの二進で1となる桁のjのみ mll m; FOR(i,0,n){cin>>v[i]; m[v[i]]++;} if(m.count(key)) for(pll p:m){ll key=p.fi; ll val=p.se;} */ const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; void Comuse() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } #define comuse Comuse() ll combi(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll pow_mod(ll a,ll n,ll mod){ ll res=1; //n=k_2 pow(a,k_2) for(;n>0;n/=2){ //ex,pow(a,1011_2)=a^8*a^2*a^1 if(n%2==1)res=(res*a)%mod; a=(a*a)%mod; } return res; } ll digit_sum(ll n) { ll m=0; FOR(i,0,20){ m+=n%10; n/=10; if(n==0)break; } return m; } ll lcm(ll a,ll b){ ll n; n=a/gcd(a,b)*b; return n; } int main(){ ll n,m; cin>>n>>m; vmll vm(n+1); ll x,y; FOR(i,0,m){ cin>>x>>y; vm[x-1][y-1]++; vm[y-1][x-1]++; } bool bo=false; ll ans=0,c=0; FOR(i,0,1<<n){ FOR(j,0,n){ if((i>>j)&1){ c++; FOR(k,0,n){ if((i>>k)&1&&k!=j){ if(!vm[j].count(k)){ bo=true; break; } } } } if(bo)break; } if(!bo){ ans=max(ans,c); } bo=false; c=0; } co(ans); }
Submission Info
Submission Time | |
---|---|
Task | D - 派閥 |
User | Touri |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 3948 Byte |
Status | AC |
Exec Time | 4 ms |
Memory | 384 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt, test_61.txt, test_62.txt, test_63.txt, test_64.txt, test_65.txt, test_66.txt, test_67.txt, test_68.txt, test_69.txt, test_70.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 1 ms | 256 KB |
00_sample_02.txt | AC | 1 ms | 256 KB |
00_sample_03.txt | AC | 1 ms | 256 KB |
00_sample_04.txt | AC | 1 ms | 256 KB |
test_01.txt | AC | 1 ms | 256 KB |
test_02.txt | AC | 1 ms | 256 KB |
test_03.txt | AC | 1 ms | 256 KB |
test_04.txt | AC | 1 ms | 256 KB |
test_05.txt | AC | 1 ms | 256 KB |
test_06.txt | AC | 1 ms | 256 KB |
test_07.txt | AC | 1 ms | 256 KB |
test_08.txt | AC | 1 ms | 256 KB |
test_09.txt | AC | 1 ms | 256 KB |
test_10.txt | AC | 1 ms | 256 KB |
test_11.txt | AC | 1 ms | 256 KB |
test_12.txt | AC | 2 ms | 256 KB |
test_13.txt | AC | 1 ms | 256 KB |
test_14.txt | AC | 1 ms | 256 KB |
test_15.txt | AC | 1 ms | 256 KB |
test_16.txt | AC | 1 ms | 256 KB |
test_17.txt | AC | 2 ms | 256 KB |
test_18.txt | AC | 1 ms | 256 KB |
test_19.txt | AC | 2 ms | 256 KB |
test_20.txt | AC | 3 ms | 256 KB |
test_21.txt | AC | 1 ms | 256 KB |
test_22.txt | AC | 2 ms | 256 KB |
test_23.txt | AC | 2 ms | 256 KB |
test_24.txt | AC | 3 ms | 256 KB |
test_25.txt | AC | 2 ms | 256 KB |
test_26.txt | AC | 1 ms | 256 KB |
test_27.txt | AC | 1 ms | 256 KB |
test_28.txt | AC | 1 ms | 256 KB |
test_29.txt | AC | 1 ms | 256 KB |
test_30.txt | AC | 1 ms | 256 KB |
test_31.txt | AC | 2 ms | 256 KB |
test_32.txt | AC | 2 ms | 256 KB |
test_33.txt | AC | 2 ms | 256 KB |
test_34.txt | AC | 2 ms | 256 KB |
test_35.txt | AC | 2 ms | 256 KB |
test_36.txt | AC | 4 ms | 384 KB |
test_37.txt | AC | 1 ms | 256 KB |
test_38.txt | AC | 3 ms | 256 KB |
test_39.txt | AC | 2 ms | 256 KB |
test_40.txt | AC | 1 ms | 256 KB |
test_41.txt | AC | 3 ms | 256 KB |
test_42.txt | AC | 4 ms | 256 KB |
test_43.txt | AC | 1 ms | 256 KB |
test_44.txt | AC | 2 ms | 256 KB |
test_45.txt | AC | 2 ms | 256 KB |
test_46.txt | AC | 2 ms | 256 KB |
test_47.txt | AC | 3 ms | 256 KB |
test_48.txt | AC | 3 ms | 256 KB |
test_49.txt | AC | 1 ms | 256 KB |
test_50.txt | AC | 1 ms | 256 KB |
test_51.txt | AC | 1 ms | 256 KB |
test_52.txt | AC | 1 ms | 256 KB |
test_53.txt | AC | 1 ms | 256 KB |
test_54.txt | AC | 1 ms | 256 KB |
test_55.txt | AC | 2 ms | 256 KB |
test_56.txt | AC | 2 ms | 256 KB |
test_57.txt | AC | 2 ms | 256 KB |
test_58.txt | AC | 2 ms | 256 KB |
test_59.txt | AC | 3 ms | 256 KB |
test_60.txt | AC | 3 ms | 256 KB |
test_61.txt | AC | 4 ms | 256 KB |
test_62.txt | AC | 1 ms | 256 KB |
test_63.txt | AC | 1 ms | 256 KB |
test_64.txt | AC | 1 ms | 256 KB |
test_65.txt | AC | 1 ms | 256 KB |
test_66.txt | AC | 1 ms | 256 KB |
test_67.txt | AC | 1 ms | 256 KB |
test_68.txt | AC | 1 ms | 256 KB |
test_69.txt | AC | 1 ms | 256 KB |
test_70.txt | AC | 2 ms | 256 KB |