上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 67 下一页
摘要: 水~。 const int N=1010; int row[N]; int n; bool check(int x,int y) { for(int i=1;i<y;i++) if(row[i] == x || abs(x-row[i]) == y-i) return false; return t 阅读全文
posted @ 2021-03-05 21:31 Dazzling! 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 水~。 const int N=210; int g[N][N]; int n,m,q; int main() { cin>>n>>m; memset(g,0x3f,sizeof g); while(m--) { int a,b,c; cin>>a>>b>>c; g[a][b]=g[b][a]=c; 阅读全文
posted @ 2021-03-05 18:31 Dazzling! 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 直接暴力枚举。 bool check(int a,int b) { set<int> wolfs; wolfs.insert(a),wolfs.insert(b); int liar_human=0,liar_wolf=0; for(int i=1;i<=n;i++) { int t=state[i 阅读全文
posted @ 2021-03-05 17:58 Dazzling! 阅读(48) 评论(0) 推荐(0) 编辑
摘要: sb题,不想过多描述==。 struct Node { string id; int score; bool operator<(const Node &W) const { if(score != W.score) return score > W.score; return id < W.id; 阅读全文
posted @ 2021-03-05 12:05 Dazzling! 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 水~。 int n,k; bool isprime(int x) { for(int i=2;i*i<=x;i++) if(x % i == 0) return false; return true; } int main() { cin>>n>>k; string s; cin>>s; strin 阅读全文
posted @ 2021-03-05 11:11 Dazzling! 阅读(46) 评论(0) 推荐(0) 编辑
摘要: $STL$乱搞过去的。 map<int,set<int>> mp; int n,m; int main() { cin>>n>>m; for(int i=0;i<n;i++) { int a,b; cin>>a>>b; mp[a].insert(b); mp[b].insert(a); } whil 阅读全文
posted @ 2021-03-04 22:11 Dazzling! 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 题意 塔都市的警察局决定治理混乱,从城市中的两个帮派开始行动,Gang Dragon和Gang Snake。但是,警方首先需要确定犯罪分子属于哪个团伙。目前的问题是,两名罪犯,他们属于同一个帮派吗?您必须根据不完整的信息做出判断。(因为歹徒总是暗中行动。) 假设$N(N<= 105)$罪犯目前在塔都 阅读全文
posted @ 2021-03-04 22:03 Dazzling! 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 判断是否是合法拓扑序,水~。 const int N=1010; vector<int> g[N]; int din[N],tdin[N]; int n,m,q; int main() { cin>>n>>m; while(m--) { int a,b; cin>>a>>b; g[a].pb(b); 阅读全文
posted @ 2021-03-04 20:39 Dazzling! 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 水~。 set<int> S; int n; int main() { cin>>n; for(int i=0;i<n;i++) { int x; cin>>x; if(x > 0) S.insert(x); } int res=1; while(S.count(res)) res++; cout< 阅读全文
posted @ 2021-03-04 20:25 Dazzling! 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 水~,依旧是喜闻乐见的链表题。 题意 给出N个结点的地址address、数据域data以及指针域next,然后给出链表的首地址,要求去除链表上权值的绝对值相同的结点(只保留第-一个),之后把未删除的结点按链表连接顺序输出,接着把被删除的结点也按在原链表中的顺序输出。 const int N=1e5+ 阅读全文
posted @ 2021-03-04 17:53 Dazzling! 阅读(32) 评论(0) 推荐(0) 编辑
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 67 下一页