当前位置:网站首页>[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 ;
}
边栏推荐
- Technology dry goods | luxe model for the migration of mindspore NLP model -- reading comprehension task
- 技术干货|昇思MindSpore可变序列长度的动态Transformer已发布!
- 【踩坑系列】mysql 修改root密码失败
- Go language foundation ----- 10 ----- string related operations (operation function, string conversion)
- 【CoppeliaSim4.3】C#调用 remoteApi控制场景中UR5
- 项目经验分享:实现一个昇思MindSpore 图层 IR 融合优化 pass
- Go language foundation ------17 ----- channel creation, read-write, security shutdown, multiplexing select
- OSPF protocol summary
- 技术干货 | AlphaFold/ RoseTTAFold开源复现(2)—AlphaFold流程分析和训练构建
- 技术干货|昇思MindSpore算子并行+异构并行,使能32卡训练2420亿参数模型
猜你喜欢

Application of pigeon nest principle in Lucene minshouldmatchsumscorer

【MySQL 11】怎么解决MySQL 8.0.18 大小写敏感问题

技术干货|昇思MindSpore NLP模型迁移之Bert模型—文本匹配任务(二):训练和评估

【LeetCode】3. Merge two sorted lists · merge two ordered linked lists

Paper learning -- Study on the similarity of water level time series of Xingzi station in Poyang Lake

Iterm2设置

Go language foundation ----- 01 ----- go language features

技术干货|昇思MindSpore Lite1.5 特性发布,带来全新端侧AI体验

技术干货|昇思MindSpore可变序列长度的动态Transformer已发布!

Go language foundation ----- 05 ----- structure
随机推荐
tp3.2和tp5.0的区别
Introduction of novel RNA based cancer therapies
PAT甲级 1032 Sharing
技术干货|AI框架动静态图统一的思考
pgAdmin 4 v6.11 发布,PostgreSQL 开源图形化管理工具
Vertx's responsive redis client
An overview of IfM Engage
【MySQL 11】怎么解决MySQL 8.0.18 大小写敏感问题
Go language - loop statement
PHP微信抢红包的算法
Go language foundation ----- 10 ----- string related operations (operation function, string conversion)
项目经验分享:基于昇思MindSpore,使用DFCNN和CTC损失函数的声学模型实现
华为交换机:配置telnet和ssh、web访问
【MindSpore论文精讲】AAAI长尾问题中训练技巧的总结
Go language foundation ----- 19 ----- context usage principle, interface, derived context (the multiplexing of select can be better understood here)
HCIA notes
Pat class a 1028 list sorting
【MySQL 12】MySQL 8.0.18 重新初始化
技术干货|昇思MindSpore NLP模型迁移之LUKE模型——阅读理解任务
输入三次猜一个数字