Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sd5
#include<bits/stdc++.h> using namespace std; /* #include<boost/multiprecision/cpp_int.hpp> namespace mp=boost::multiprecision; using namespace mp;*/ //cpp_int #define mem(A) memset(A,0,sizeof(A)) #define loop(i,a,n) for(long long i=a;i<n;i++) #define pb push_back #define mkp make_pair #define prq priority_queue #define fir first #define sec second #define all(A) A.begin(),A.end() #define mod 1000000007 #define take(t) ll t;cin>>t;while(t--) #define en "\n" typedef long long ll; typedef pair<ll,ll> pll; int main() { //freopen("input.txt", "r", stdin); ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); map<vector<ll>,ll> M;ll n=5; loop(i,0,n) { loop(j,0,n) { loop(k,0,n) { loop(l,0,n) { loop(m,0,n) { vector<ll> A(n); A[0]=1; A[1]=2; A[2]=3; A[3]=4; A[4]=5; swap(A[0],A[i]); swap(A[1],A[j]); swap(A[2],A[k]); swap(A[3],A[l]); swap(A[4],A[m]); M[A]++; //\cout<<A[0]<<" "<<A[1]<<" "<<A[2]<<" "<<i<<j<<k<<en; } } } } } multimap<ll,vector<ll>> N; for(auto it:M){ N.insert(mkp(it.sec,it.fir)); } for(auto it:N) { loop(i,0,it.sec.size()) cout<<it.sec[i]; cout<<" "<<it.fir<<endl; } }
run
|
edit
|
history
|
help
0
single_digit
graph representation Adjacency List
data locality - fast example
3SUM problem
decode
Palindromo
arthi3.cpp
perfect square
ApelRefVal
sample1