当前位置:网站首页>[at] ABC 258g - triple Reach - violence
[at] ABC 258g - triple Reach - violence
2022-07-03 07:44:00 【* DDL Gzmblog】
Préface
t a g : tag : tag:bitset01Fig.
Porte de transfert:
Titre :
Compte tenu d'un 01 01 01Graphique complet, 1 1 1Cela signifie que les deux points ont des bords reliés, 0 0 0Ça veut dire qu'il n'y a pas de bords reliant ces deux points
Demandez combien de triples il y a ( i , j , k ) (i,j,k) (i,j,k),Il y a des bords qui relient les deux
Idées :
Pratiques violentes n 3 n^3 n3,Parce que le graphique n'existe que 01 01 01,Nous envisageons d'utiliser des opérations de bits moins une couche d'énumération
C'est - à - dire:bitset , Nous mettons l'état dansbisetMoyenne,Puis énumérez les états entre les deux lignes,En cours & \& &Opération
Apparemment, si & = 1 \&=1 &=1Alors,Trois points sont accessibles,Complexité temporelle n 2 l o g n n^2logn n2logn
code :
void solve(){
int n;cin>>n;
vector<bitset<N>> v(n);
vector<string> s(n);
for(int i = 0; i < n; i ++ ){
cin>>s[i];
for(int j = 0 ; j < n ; j ++ ){
if(s[i][j] == '1') v[i][j] = 1;
}
}
ll ans = 0 ;
for(int i = 0 ; i< n ; i ++ ){
for(int j = 0 ; j< i ; j ++ ){
if(s[i][j] == '1') ans += (v[i]&v[j]).count();
}
}
cout<<ans/3<<endl;
}
int main(){
//int t;cin>>t;while(t--)
solve();
return 0 ;
}
边栏推荐
- 什么是定义?什么是声明?它们有何区别?
- OSPF experiment
- 【LeetCode】4. Best time to buy and sell stock
- The difference between typescript let and VaR
- Project experience sharing: Based on mindspore, the acoustic model is realized by using dfcnn and CTC loss function
- 技术干货|利用昇思MindSpore复现ICCV2021 Best Paper Swin Transformer
- 圖像識別與檢測--筆記
- What did the DFS phase do
- Image recognition and detection -- Notes
- Industrial resilience
猜你喜欢

Go language foundation ----- 15 ----- reflection

Go language foundation ------ 14 ------ gotest
![[MySQL 12] MySQL 8.0.18 reinitialization](/img/e1/9874df18bbc8d80c3c5c5fe39aefc9.png)
[MySQL 12] MySQL 8.0.18 reinitialization

Go language foundation ----- 10 ----- string related operations (operation function, string conversion)

Technical dry goods | hundred lines of code to write Bert, Shengsi mindspire ability reward

Go language foundation ----- 09 ----- exception handling (error, panic, recover)

Technical dry goods Shengsi mindspire lite1.5 feature release, bringing a new end-to-end AI experience

Application of pigeon nest principle in Lucene minshouldmatchsumscorer

Lucene hnsw merge optimization
![[coppeliasim4.3] C calls UR5 in the remoteapi control scenario](/img/ca/2f72ea3590c358a6c9884aaa1a1c33.png)
[coppeliasim4.3] C calls UR5 in the remoteapi control scenario
随机推荐
PAT甲级 1027 Colors in Mars
华为S5700交换机初始化和配置SSH和TELNET远程登录方法
研究显示乳腺癌细胞更容易在患者睡觉时进入血液
C2 several methods of merging VCF files
Web router of vertx
Precautions for opensips and TLS SIP trunk docking
Go language foundation ----- 13 ----- file
Technical dry goods Shengsi mindspire operator parallel + heterogeneous parallel, enabling 32 card training 242 billion parameter model
Structure of golang
Analysis of the eighth Blue Bridge Cup single chip microcomputer provincial competition
PAT甲级 1031 Hello World for U
Technical dry goods Shengsi mindspire lite1.5 feature release, bringing a new end-to-end AI experience
Professor Zhang Yang of the University of Michigan is employed as a visiting professor of Shanghai Jiaotong University, China (picture)
Go language foundation ----- 04 ----- closure, array slice, map, package
Project experience sharing: Based on mindspore, the acoustic model is realized by using dfcnn and CTC loss function
PHP常用排序算法
Responsive MySQL of vertx
Harmonyos third training notes
EtherCAT state machine transition (ESM)
Go language foundation ----- 01 ----- go language features