当前位置:网站首页>abc 258 G - Triangle(bitset)
abc 258 G - Triangle(bitset)
2022-07-05 00:05:00 【eva_ can(not)survive】
G - Trianglehttps://atcoder.jp/contests/abc258/tasks/abc258_g Direct use bitset Existential adjacency matrix , Violence is enough
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <cmath>
#include <map>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const int MN = 65005;
const int MAXN = 1e6 + 10;
const int INF = 0x3f3f3f3f;
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) ((x)&(-x))
using P = pair<int, int>;
const int N = (int) 3e3 + 5;
//int s[5000][5000];
bitset<N> s[N];
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
string str;
cin >> str;
reverse(str.begin(), str.end());
s[i] = bitset<N>(str);
}
ll res = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (s[i][j] == 1) {
res += (s[i] & s[j]).count();
}
}
}
printf("%lld", res / 3);
return 0;
}
边栏推荐
- Paddleocr tutorial
- Meet ThreadPoolExecutor
- Design of emergency lighting evacuation indication system for urban rail transit station
- 如何在外地外网电脑远程公司项目?
- Réseau graphique: Qu'est - ce que le Protocole d'équilibrage de charge de passerelle glbp?
- Is it safe to open an account in the College of Finance and economics? How to open an account?
- Using the uniapp rich text editor
- Illustrated network: what is gateway load balancing protocol GLBP?
- [IELTS reading] Wang Xiwei reads P4 (matching2 paragraph information matching question [difficult])
- How long does it take to obtain a PMP certificate?
猜你喜欢
Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
人脸识别5- insight-face-paddle-代码实战笔记
Using fast parsing intranet penetration to realize zero cost self built website
Some basic functions of enterprise projects are developed, and important things are saved to online first a
机器人强化学习——Learning Synergies between Pushing and Grasping with Self-supervised DRL (2018)
OSEK standard ISO_ 17356 summary introduction
Application of fire fighting system based on 3D GIS platform
"Xiaodeng" domain password policy enhancer in operation and maintenance
Combien de temps faut - il pour obtenir un certificat PMP?
雅思考试流程、需要具体注意些什么、怎么复习?
随机推荐
Application of multi loop instrument in base station "switching to direct"
Business implementation - the log is written to the same row of data
IELTS examination process, what to pay attention to and how to review?
How to apply for PMP project management certification examination?
[IELTS reading] Wang Xiwei reading P4 (matching1)
How to save your code works quickly to better protect your labor achievements
公司要上监控,Zabbix 和 Prometheus 怎么选?这么选准没错!
企业应用业务场景,功能添加和修改C#源码
取得PMP證書需要多長時間?
Using the uniapp rich text editor
Solve the problem that the virtual machine cannot be remotely connected through SSH service
It's too convenient. You can complete the code release and approval by nailing it!
The input of uniapp is invalid except for numbers
How to effectively monitor the DC column head cabinet
OpenHarmony资源管理详解
Is it safe to open and register new bonds? Is there any risk? Is it reliable?
45 year old professor, she threw two super unicorns
Five papers recommended for the new development of convolutional neural network in deep learning
Jar批量管理小工具
uniapp上传头像