跳到正文

txrw

684243

2025

在洛谷打开
资料、奖项与版本

资料

编号
684243
抓取

快读快写

C++
inline int read(){
   int x=0,f=1;char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
   while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
   return x*f;
}
C++
inline void write(int a){
  if(a>9)
      write(a/10);
  putchar(a%10+'0');
}

STL

C++
list<int> List;
map<int,int> Map;
vector<int> Vector;
queue<int> Queue;
deque<int> Deque;
stack<int> Stack;

C++
#include <bits/stdc++.h>
using namespace std;
#define int long long

inline int read(){
   int x=0,f=1;char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
   while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
   return x*f;
}

signed main(){
	
	return 0;
}

INTP CF txr

Draw NOI OIerDb Oiwiki LaTeX Math Go

共 2 篇
  1. 题解

    题解:P12698 [KOI 2022 Round 2] 树与查询

    思路 可以把给出点集分成不同连通块,容易得到,对于不同连通块,答案贡献为 siz×(siz-1)div2。 考虑如何求连通块。对与某个点,如果它和它的父亲都在点集内,那么可以直接放入一个并查集(可以抽象成缩为一个点)。 注意每次更新并查集。 具体见代码。 Code:

  2. 题解

    题解:P3907 圈的异或

    建一棵树,其余的边为非树边,则现在图中有树边和非树边。 那么一个环的异或和为非树边左端点到根的路径上边的异或和,异或上右端点到根的异或和,再异或上这条非树边的权值即可。 Code: