比赛链接

A

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <bits/stdc++.h>
using namespace std;

#define IO ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
typedef long long ls;
const int N = 1e5 + 10;

int n;

void sol(){
cin >> n;
int a[N];
for (int i = 1; i <= n; i++)
cin >> a[i];
ls sum = 0;
for (int i = 1; i <= n; i++){
int cnt = 0;
for (int j = 1; j <= n; j++)
if (a[j] <= a[i] && i != j)
cnt++;
if (cnt >= 1.0 * (n - 1) * 0.8){
//cout << i << endl;
sum += a[i];
}
}
cout << sum << endl;
}


int main(){
IO
sol();
}

B

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <bits/stdc++.h>
using namespace std;

#define IO ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
typedef long long ls;
const int N = 2e5 + 10;

int n, q, s;
int t[N], xx, yy;
ls y[N];

void sol(){
cin >> n >> q >> s;
for (int i = 1; i <= n; i++) cin >>t[i];
//ls k = s;
y[1] = s;
for (int i = 2; i <= n; i++){
y[i] = y[i - 1] + t[i - 1];
}
while (q--){
cin >> xx >> yy;
cout << y[xx] + yy - 1 << endl;
}
}


int main(){
IO
sol();
}

C

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <bits/stdc++.h>
using namespace std;

#define IO ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
typedef long long ls;
const int N = 2e5 + 10;

int n;

void sol(){
cin >> n;
for (int i = 0; i < (int)pow(2, n); i++)
cout << (i ^ (i >> 1)) << ' ';
cout << endl;
}


int main(){
IO
// cin >> t;
// while (t--){
sol();
// }
}

F

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <bits/stdc++.h>
using namespace std;

#define IO ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
typedef long long ls;
const int N = 5e3 + 10;



void sol(){
int a, b; cin >> a >> b;
if (a == 0){
string s(b, '1');
cout << s << endl;
return;
}
if (b == 0){
string s(a, '0');
cout << s << endl;
return;
}
int c0 = a, c1 = b;
char A = '0', B = '1';
if (c0 < c1){
swap(c0, c1);
swap(A, B);
}
//每段多少个
int base = c0 / (c1 + 1);
int rm = c0 % (c1 + 1);

string ans;
for (int i = 1; i <= c1 + 1; i++){
int len = base + (i <= rm ? 1 : 0);
string s(len, A);
if (i <= c1) s += B;
ans += s;
}
cout << ans << endl;
}


int main(){
IO
int t; cin >> t;
while (t--)
sol();
}


G

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <bits/stdc++.h>
using namespace std;

#define IO ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
typedef long long ls;
const int N = 5e3 + 10;



void sol(){
cout << "27777789999999999 277777788888899\n";
}


int main(){
IO
// int t; cin >> t;
// while (t--)
sol();
}


H

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <bits/stdc++.h>
using namespace std;

#define IO ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
typedef long long ls;
const int N = 510;

int atx[13] = {-2,-1,-1,-1,0,0,0,0,0,1,1,1,2};
int aty[13] = {0,-1,0,1,-2,-1,0,1,2,-1,0,1,0};

void sol(){
int n, m, q; cin >> n >> m >> q;
vector<vector<int> > v(n+1, vector<int> (m+1));
vector<vector<ls> > cnt(n+1, vector<ls> (m+1));
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
cin >> v[i][j];
ls maxn = -1;
int xx, yy;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++){
ls sum = 0;
for (int k = 0; k < 13; k++){
int sx = i + atx[k];
int sy = j + aty[k];
if (sx>=1&&sx<=n&&sy>=1&&sy<=m)
sum += v[sx][sy];
}
cnt[i][j] = sum;
if (sum > maxn){
maxn = sum;
xx = i;
yy = j;
}
}
while (q--){
int x, y, add; cin >> x >> y >> add;
ls maxx = -1;
int tx, ty;
for (int k = 0; k < 13; k++){
int sx = x + atx[k];
int sy = y + aty[k];
if (sx>=1&&sx<=n&&sy>=1&&sy<=m){
cnt[sx][sy] += add;
if (cnt[sx][sy] > maxx){
maxx = cnt[sx][sy];
tx = sx, ty = sy;
}
}
}
if (maxx > maxn){
maxn = maxx;
xx = tx;
yy = ty;
}
cout << xx << ' ' << yy << endl;
}
}


int main(){
IO
// cin >> t;
// while (t--){
sol();
// }
}

I

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <bits/stdc++.h>
using namespace std;

#define IO ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
typedef long long ls;
const int N = 5e3 + 10;

void sol(){
cout << "######";
}


int main(){
IO
sol();
}