当前位置:网站首页>abc 258 G - Triangle(bitset)
abc 258 G - Triangle(bitset)
2022-07-05 00:02:00 【eva_can(not)survive】
G - Triangle
https://atcoder.jp/contests/abc258/tasks/abc258_g直接用bitset存邻接矩阵,暴力一下就行
#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;
}
边栏推荐
- Power operation and maintenance cloud platform: open the new mode of "unattended and few people on duty" of power system
- go踩坑——no required module provides package : go.mod file not found in current directory or any parent
- Etcd database source code analysis - brief process of processing entry records
- 华泰证券低佣金的开户链接安全吗?
- Is it safe to open and register new bonds? Is there any risk? Is it reliable?
- 企业里Win10 开启BitLocker锁定磁盘,如何备份系统,当系统出现问题又如何恢复,快速恢复又兼顾系统安全(远程设备篇)
- 业务场景功能的继续修改
- Solve the problem that the virtual machine cannot be remotely connected through SSH service
- go踩坑——no required module provides package : go.mod file not found in current directory or any parent
- MIT-6.824-lab4B-2022(万字思路讲解-代码构建)
猜你喜欢

基于三维gis平台的消防系统运用

Using the uniapp rich text editor

"Xiaodeng" domain password policy enhancer in operation and maintenance

Robot reinforcement learning synergies between pushing and grassing with self supervised DRL (2018)

企业公司项目开发好一部分基础功能,重要的事保存到线上第一a

C language to quickly solve the reverse linked list

Hash table, hash function, bloom filter, consistency hash

How many triangles are there in the golden K-line diagram?

Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...

PMP证书续证流程
随机推荐
香港珠宝大亨,22亿“抄底”佐丹奴
【雅思阅读】王希伟阅读P3(Heading)
城市轨道交通站应急照明疏散指示系统设计
He worked as a foreign lead and paid off all the housing loans in a year
基于三维gis平台的消防系统运用
Basic points of the game setup of the points mall
Netcore3.1 JSON web token Middleware
How to reduce the stock account Commission and stock speculation commission? Is it safe to open an online account
如何报考PMP项目管理认证考试?
同事的接口文档我每次看着就头大,毛病多多。。。
MIT-6.824-lab4B-2022(万字思路讲解-代码构建)
Design of emergency lighting evacuation indication system for urban rail transit station
Is it safe to open and register new bonds? Is there any risk? Is it reliable?
QT addition calculator (simple case)
In June, the list of winners of "Moli original author program" was announced! Invite you to talk about the domestic database
如何用快解析自制IoT云平台
[JS] - [sort related] - Notes
【北京大学】Tensorflow2.0-1-开篇
Application of multi loop instrument in base station "switching to direct"
The pit of sizeof operator in C language