Hand speed field.
Topic link: http://codeforces.com/contest/1201
A:
Simulation is done according to the meaning of the question.
1 /* basic header */
2 #include
3 /* define */
4 #define ll long long
5 #define dou double
6 #define pb emplace_back
7 #define mp make_pair
8 #define sot(a,b) sort(a+1 ,a+1+b)
9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19
20 int n, m;
21 string s[1010];
22 int a[1010];
23 ll ans = 0;
24
25 int main() {
26 cin >> n >> m;
27 for (int i = 1; i <= n; i++) cin >> s[i];
28 for (int i = 1; i <= m; i++) cin >> a[i];
29 for (int j = 0; j) {
30 int maxx = 0; map<char, int> m;
31 for (int i = 1; i <= n; i++) maxx = max(maxx, ++m[s[i][j]]);
32 ans += (ll)maxx * a[j + 1 ];
33 }
34 printf("%lld ", ans);
35 return 0;
36 }
View Code div>
B:
Check whether the sum of all elements is an odd number, if it is an odd number, NO.
If the largest element is greater than half of the sum, it is also NO.
1 /* basic header */
2 #include
3 /* define */
4 #define ll long long
5 #define dou double
6 #define pb emplace_back
7 #define mp make_pair
8 #define sot(a,b) sort(a+1 ,a+1+b)
9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19
20 int x, n, maxx = 0;
21 ll sum = 0;
22
23 int main() {
24 scanf("%d", &n);
25 rep1(i, 1, n) {
26 int x; scanf("%d", & x);
27 maxx = max(maxx, x);
28 sum += x;
29 }
30 if (sum2 || sum & 1) puts( "NO");
31 else puts("YES");
32 return 0;
33 }
View Code div>
C:
Just fill in from the position of n/2+1.
1 /* basic header */
2 #include
3 /* define */
4 #define ll long long
5 #define dou double
6 #define pb emplace_back
7 #define mp make_pair
8 #define sot(a,b) sort(a+1 ,a+1+b)
9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19
20 const int maxn = 2e5 + 10;
21 ll n, k, a[maxn];
22
23 int main() {
24 scanf("%lld%lld", &n, &k);
25 rep1(i, 1, n) scanf ("%lld"< /span>, &a[i]);
26 sot(a, n);
27 int cnt = 1;
28 for (int i = n / 2 + 1; i) { 29 if (k / cnt >= a[ i + 1] - a[i]) {
30 k -= (a[i + 1 ]-a[i]) * cnt;
31 cnt++;
32} else return printf("%lld < span style="color: #800000;">", a[i] + k / cnt), 0;
33 }
34 printf("%lld ", a[n] + k / (n / 2 + 1));
35 return 0;
36 }
View Code div>
1 /* basic header */
2 #include
3 /* define */
4 #define ll long long
5 #define dou double
6 #define pb emplace_back
7 #define mp make_pair
8 #define sot(a,b) sort(a+1 ,a+1+b)
9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19
20 int n, m;
21 string s[1010];
22 int a[1010];
23 ll ans = 0;
24
25 int main() {
26 cin >> n >> m;
27 for (int i = 1; i <= n; i++) cin >> s[i];
28 for (int i = 1; i <= m; i++) cin >> a[i];
29 for (int j = 0; j) {
30 int maxx = 0; map<char, int> m;
31 for (int i = 1; i <= n; i++) maxx = max(maxx, ++m[s[i][j]]);
32 ans += (ll)maxx * a[j + 1 ];
33 }
34 printf("%lld ", ans);
35 return 0;
36 }
View Code p>
1 /* basic header */
2 #include
3 /* define */
4 #define ll long long
5 #define dou double
6 #define pb emplace_back
7 #define mp make_pair
8 #define sot(a,b) sort(a+1 ,a+1+b)
9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19
20 int n, m;
21 string s[1010];
22 int a[1010];
23 ll ans = 0;
24
25 int main() {
26 cin >> n >> m;
27 for (int i = 1; i <= n; i++) cin >> s[i];
28 for (int i = 1; i <= m; i++) cin >> a[i];
29 for (int j = 0; j) {
30 int maxx = 0; map<char, int> m;
31 for (int i = 1; i <= n; i++) maxx = max(maxx, ++m[s[i][j]]);
32 ans += (ll)maxx * a[j + 1 ];
33 }
34 printf("%lld ", ans);
35 return 0;
36 }
1 /* basic header */
2 #include
3 /* define */
4 #define ll long long
5 #define dou double
6 #define pb emplace_back
7 #define mp make_pair
8 #define sot(a,b) sort(a+1 ,a+1+b)
9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19
20 int x, n, maxx = 0;
21 ll sum = 0;
22
23 int main() {
24 scanf("%d", &n);
25 rep1(i, 1, n) {
26 int x; scanf("%d", &x);
27 maxx = max(maxx, x);
28 sum += x;
29 }
30 if (sum < maxx * 2 || sum & 1) puts("NO");
31 else puts("YES");
32 return 0;
33 }
View Code
1 /* basic header */
2 #include
3 /* define */
4 #define ll long long
5 #define dou double
6 #define pb emplace_back
7 #define mp make_pair
8 #define sot(a,b) sort(a+1,a+1+b)
9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19
20 int x, n, maxx = 0;
21 ll sum = 0;
22
23 int main() {
24 scanf("%d", &n);
25 rep1(i, 1, n) {
26 int x; scanf("%d", &x);
27 maxx = max(maxx, x);
28 sum += x;
29 }
30 if (sum < maxx * 2 || sum & 1) puts("NO");
31 else puts("YES");
32 return 0;
33 }
1 /* basic header */
2 #include
3 /* define */
4 #define ll long long
5 #define dou double
6 #define pb emplace_back
7 #define mp make_pair
8 #define sot(a,b) sort(a+1,a+1+b)
9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19
20 const int maxn = 2e5 + 10;
21 ll n, k, a[maxn];
22
23 int main() {
24 scanf("%lld%lld", &n, &k);
25 rep1(i, 1, n) scanf("%lld", &a[i]);
26 sot(a, n);
27 int cnt = 1;
28 for (int i = n / 2 + 1; i < n; i++) {
29 if (k / cnt >= a[i + 1] - a[i]) {
30 k -= (a[i + 1] - a[i]) * cnt;
31 cnt++;
32 } else return printf("%lld ", a[i] + k / cnt), 0;
33 }
34 printf("%lld ", a[n] + k / (n / 2 + 1));
35 return 0;
36 }
View Code
1 /* basic header */
2 #include
3 /* define */
4 #define ll long long
5 #define dou double
6 #define pb emplace_back
7 #define mp make_pair
8 #define sot(a,b) sort(a+1,a+1+b)
9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19
20 const int maxn = 2e5 + 10;
21 ll n, k, a[maxn];
22
23 int main() {
24 scanf("%lld%lld", &n, &k);
25 rep1(i, 1, n) scanf("%lld", &a[i]);
26 sot(a, n);
27 int cnt = 1;
28 for (int i = n / 2 + 1; i < n; i++) {
29 if (k / cnt >= a[i + 1] - a[i]) {
30 k -= (a[i + 1] - a[i]) * cnt;
31 cnt++;
32 } else return printf("%lld ", a[i] + k / cnt), 0;
33 }
34 printf("%lld ", a[n] + k / (n / 2 + 1));
35 return 0;
36 }
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5654 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC