当前位置:网站首页>abc 258 G - Triangle(bitset)
abc 258 G - Triangle(bitset)
2022-07-05 00:02:00 【eva_can(not)survive】
G - Trianglehttps://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;
}
边栏推荐
- In June, the list of winners of "Moli original author program" was announced! Invite you to talk about the domestic database
- 电力运维云平台:开启电力系统“无人值班、少人值守”新模式
- [ODX studio edit PDX] -0.3- how to delete / modify inherited elements in variant variants
- 如何有效对直流列头柜进行监测
- The input of uniapp is invalid except for numbers
- How to reduce the stock account Commission and stock speculation commission? Is it safe to open an online account
- Cross domain request
- 人脸识别5- insight-face-paddle-代码实战笔记
- Power operation and maintenance cloud platform: open the new mode of "unattended and few people on duty" of power system
- [paper reading] Tun det: a novel network for meridian ultra sound nodule detection
猜你喜欢
Tester's algorithm interview question - find mode
C language to quickly solve the reverse linked list
French scholars: the explicability of counter attack under optimal transmission theory
Application of fire fighting system based on 3D GIS platform
Consolidated expression C case simple variable operation
Application of multi loop instrument in base station "switching to direct"
电力运维云平台:开启电力系统“无人值班、少人值守”新模式
Jar批量管理小工具
蓝天NH55系列笔记本内存读写速度奇慢解决过程记录
取得PMP證書需要多長時間?
随机推荐
PMP证书续证流程
Skills in analyzing the trend chart of London Silver
Ap8022 switching power supply small household appliances ACDC chip offline switching power supply IC
人脸识别5- insight-face-paddle-代码实战笔记
企业公司项目开发好一部分基础功能,重要的事保存到线上第一a
Actual combat simulation │ JWT login authentication
Using fast parsing intranet penetration to realize zero cost self built website
Business implementation - the log is written to the same row of data
Fast analysis -- easy to use intranet security software
Is it safe to open and register new bonds? Is there any risk? Is it reliable?
go踩坑——no required module provides package : go.mod file not found in current directory or any parent
圖解網絡:什麼是網關負載均衡協議GLBP?
Fs8b711s14 electric wine bottle opener MCU IC scheme development special integrated IC
Remember to build wheels repeatedly at one time (the setting instructions of obsidian plug-in are translated into Chinese)
22-07-02周总结
【雅思阅读】王希伟阅读P3(Heading)
OSEK standard ISO_ 17356 summary introduction
[paper reading] Tun det: a novel network for meridian ultra sound nodule detection
Solve the problem that the virtual machine cannot be remotely connected through SSH service
微软禁用IE浏览器后,打开IE浏览器闪退解决办法