当前位置:网站首页>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;
}
边栏推荐
- JS how to realize array to tree
- 股票账户佣金怎么调低,炒股佣金怎么调低网上开户安全吗
- Combien de temps faut - il pour obtenir un certificat PMP?
- [path planning] RRT adds dynamic model for trajectory planning
- How to avoid arc generation—— Aafd fault arc detector solves the problem for you
- [论文阅读] CarveMix: A Simple Data Augmentation Method for Brain Lesion Segmentation
- Hong Kong Jewelry tycoon, 2.2 billion "bargain hunting" Giordano
- 人脸识别5- insight-face-paddle-代码实战笔记
- 实战模拟│JWT 登录认证
- 【雅思阅读】王希伟阅读P4(matching2段落信息配对题【困难】)
猜你喜欢
巩固表达式C# 案例简单变量运算
S32 design studio for arm 2.2 quick start
Fs8b711s14 electric wine bottle opener MCU IC scheme development special integrated IC
城市轨道交通站应急照明疏散指示系统设计
In the enterprise, win10 turns on BitLocker to lock the disk, how to back up the system, how to recover when the system has problems, and how to recover quickly while taking into account system securi
【雅思阅读】王希伟阅读P3(Heading)
同事的接口文档我每次看着就头大,毛病多多。。。
圖解網絡:什麼是網關負載均衡協議GLBP?
用快解析内网穿透实现零成本自建网站
Face recognition 5- insight face padding code practice notes
随机推荐
[IELTS reading] Wang Xiwei reading P3 (heading)
取得PMP證書需要多長時間?
Life is changeable, and the large intestine covers the small intestine. This time, I can really go home to see my daughter-in-law...
【雅思阅读】王希伟阅读P4(matching1)
Cross domain request
[JS] - [sort related] - Notes
Illustrated network: what is gateway load balancing protocol GLBP?
Five papers recommended for the new development of convolutional neural network in deep learning
城市轨道交通站应急照明疏散指示系统设计
机器人强化学习——Learning Synergies between Pushing and Grasping with Self-supervised DRL (2018)
Enterprise application business scenarios, function addition and modification of C source code
快解析——好用的内网安全软件
How to save your code works quickly to better protect your labor achievements
The pit of sizeof operator in C language
[paper reading] Tun det: a novel network for meridian ultra sound nodule detection
Summer challenge brings you to play harmoniyos multi terminal piano performance
【雅思阅读】王希伟阅读P4(matching2段落信息配对题【困难】)
Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
Pytoch --- use pytoch to realize linknet for semantic segmentation
Fast analysis -- easy to use intranet security software