void slove() { int n,k; cin >> n >> k; set<int> st; for(int i=0;i<n;i++){ int a; cin >> a; st.insert(a); } for(int i=0;i<k;i++){ if(st.find(i)==st.end()){ cout << i << "\n"; return ; } } cout << k << "\n"; } 发
set<int, greater<>> B[400005], R[400005]; void del(int r, int c) { T[r].erase(c); B[r].erase(c); L[c].erase(r); R[c].erase(r); } int main() { int h, w, q; scanf("%d%d%d", &h, &w, &q); for (int i = 1; i <= h; i++) { ...
定义f[l, r, k, c]为,第 l 个到第 r 个字符串的从左到右的第k位大于等于c的方案数,最终答案为,f[0, n-1, 0, 0]。状态设计的来源为字典序大小的比较的递归定义,s1 < s2,要么当前位的大小关系,相等就是去掉当前位的大小关系。可以得到转移方程...
https://atcoder.jp/contests/abc285/tasks/abc285_a 小码匠代码 代码语言:javascript 代码运行次数:0 运行 AI代码解释 #include<bits/stdc++.h>using namespace std;#define endl'\n';voidbest_coder(){int a,b;cin>>a>>b;if(b==a*2||b==a*2+1){cout<<"Yes";}else{cout<<"No";}}voidha...
1#include <iostream>2#include <cstdio>3#include <vector>4#include <algorithm>5#include <queue>6#include <vector>7#include 8#include <cstdlib>9#include <cstring>10#include <cmath>11#include <set>12typedeflonglongll;13constintINF=0x3f3f3f3f;14usingnamespacestd;15intn,m,k,dis[110000][...
直接用 set 维护 inline void solve() { int l, q; cin >> l >> q; set<int> se; se.insert(0); se.insert(l); while (q --) { int op, x; cin >> op >> x; if (op == 1) se.insert(x); else { auto it = se.lower_bound(x); cout << *it - *prev(it) << "\n...
set 实现 priority queue 实现 10 AtCoder Grand Contest 022 Problem D 10.1 题目背景 AtCoder Grand Contest 022 Problem D 10.2 题目大意 ⼀个车在0 到L 之间来回游荡,速度为1。从0 出发,L, 3L, 5L, . . . 的时间到右端点。0, 2L, 4L, . . . ...
C题 AC代码 #include <bits/stdc++.h> using namespace std; int n, m, k, a[110][110], b[110]; char is_ok[110]; int ans; void check { for (int i = 1; i <= m; i++) { int total = 0; for (int j = 1; j <= a[i][0]; j++) { total += b[a[i][j]]; }...
C题 AC代码 #include <bits/stdc++.h> using namespace std; int n, m, k, a[110][110], b[110]; char is_ok[110]; int ans; void check { for (int i = 1; i <= m; i++) { int total = 0; for (int j = 1; j <= a[i][0]; j++) { ...
For C, we can only move to integer points, so this will not work for any values that aren't perfect squares. → Reply Yianlaen 6 years ago, hide # | ← Rev. 2 +5 As a junior high student, I think Problem D is unfair because we haven't learnt the arcsin function before th...