当前位置:网站首页>abc 258 G - Triangle(bitset)
abc 258 G - Triangle(bitset)
2022-07-05 00:05:00 【eva_ can(not)survive】
G - Triangle
https://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;
}
边栏推荐
- [IELTS reading] Wang Xiwei reading P4 (matching1)
- 【监控】zabbix
- Tester's algorithm interview question - find mode
- Microservice
- go踩坑——no required module provides package : go.mod file not found in current directory or any parent
- 青海省国家湿地公园功能区划数数据、全国湿地沼泽分布数据、全国省市县自然保护区
- 香港珠宝大亨,22亿“抄底”佐丹奴
- 使用快解析搭建自己的minecraft服务器
- PMP certificate renewal process
- Illustrated network: what is gateway load balancing protocol GLBP?
猜你喜欢

Application of multi loop instrument in base station "switching to direct"

Mit-6.824-lab4b-2022 (10000 word idea explanation - code construction)

Application of fire fighting system based on 3D GIS platform

The input of uniapp is invalid except for numbers

"Xiaodeng" domain password policy enhancer in operation and maintenance

How many triangles are there in the golden K-line diagram?
Date time type and format in MySQL

Solution record of jamming when using CAD to move bricks in high configuration notebook

Réseau graphique: Qu'est - ce que le Protocole d'équilibrage de charge de passerelle glbp?

How to do the project of computer remote company in foreign Internet?
随机推荐
Using the uniapp rich text editor
业务场景功能的继续修改
How to save your code works quickly to better protect your labor achievements
[paper reading] cavemix: a simple data augmentation method for brain vision segmentation
Microservice
Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
业务实现-日志写到同一个行数据里面
js正则表达式之中文验证(转)
Cross domain request
JS convert pseudo array to array
【雅思阅读】王希伟阅读P4(matching2段落信息配对题【困难】)
[paper reading] Tun det: a novel network for meridian ultra sound nodule detection
JS 将伪数组转换成数组
How to effectively monitor the DC column head cabinet
Ap8022 switching power supply small household appliances ACDC chip offline switching power supply IC
机器人强化学习——Learning Synergies between Pushing and Grasping with Self-supervised DRL (2018)
The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
Hash table, hash function, bloom filter, consistency hash
Some basic functions of enterprise projects are developed, and important things are saved to online first a
Application of fire fighting system based on 3D GIS platform