10
418429661 507737753
65169664 688434084
413093800 274858870
631767266 42769340
898214935 257992265
<100 bytes omitted>
用户输出
3775968953
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#46146 | #1002. B. 说服合伙人 | Wrong Answer | 25 | 2140 ms | 1768 K | C / 9.1 K | 旭 | 2020-08-19 19:51:35 |
#define _CAT_SECURE_NO_WARNINGS
#include <stdio.h>
long long int zhizhen1 = 0; //设置指针1
long long int sum = 0; //用以记录已经处理过的牌数
long long int he = 0; //设置cyy的和
long long int str1[100000] = { 0 }, str2[100000] = { 0 }, str3[100000] = { 0 }, str4[100000] = { 0 },
str5[100000] = { 0 }; //全局变量-可在子函数和主函数中应用
void shuru(long long int n); //输入函数
void paixv(long long int n); //排序函数
void shenrupaixv(long long int n); //深入排序函数
void yanzheng(long long int n); //验证函数
void bianma(long long int n); //编码函数
void bianmacsf(long long int n); // csf的编码函数
void paixvcsf(long long int n); // csf的排序函数
void shenrupaixvcsf(long long int n); // csf的深入排序函数
long long int xunzuizhi(long long int n); //用以寻找str1中的最大值
long long int qinglingcsf(long long int n, long long int max); // csf的清零函数
void qushu(long long int n, long long int zhizhen1); //取数函数,用于取出str2中的两个可取数
void case1(long long int zhizhen6, long long int zhizhen8); //情况1处理函数,一大一小牌。
void case2(long long int zhizhen6, long long int zhizhen8); //两张大牌的函数
void case3(long long int zhizhen6, long long int zhizhen8, long long int n,
long long int paishu); //两张小牌的处理函数
void case3(long long int zhizhen6, long long int zhizhen8, long long int n, long long int paishu) {
for (long long int l = zhizhen8; l < n; l++) {
if (str3[l] <= paishu) {
he = he + str2[l];
str1[l] = str2[l] = 0;
sum++;
break;
}
}
}
void case2(long long int zhizhen6, long long int zhizhen8) {
if (str2[zhizhen6] > str2[zhizhen8]) {
he = he + str2[zhizhen6];
str1[zhizhen6] = str2[zhizhen6] = 0;
sum++;
} else if (str2[zhizhen6] < str2[zhizhen8]) {
he = he + str2[zhizhen8];
str1[zhizhen8] = str2[zhizhen8] = 0;
sum++;
} else if (str2[zhizhen6] == str2[zhizhen8]) {
if (str1[zhizhen6] >= str1[zhizhen8]) {
he = he + str2[zhizhen6];
str1[zhizhen6] = str2[zhizhen6] = 0;
sum++;
} else {
he = he + str2[zhizhen8];
str1[zhizhen8] = str2[zhizhen8] = 0;
sum++;
}
}
}
void bianmacsf(long long int n) {
for (long long int i = 0; i < n; i++) {
str5[i] = i + 1;
} //用str5对数组1从大到小进行编号
}
void case1(long long int zhizhen6, long long int zhizhen8) {
if (str2[zhizhen6] > str2[zhizhen8]) {
he = he + str2[zhizhen6];
str1[zhizhen6] = str2[zhizhen6] = 0;
sum++;
} else if (str2[zhizhen6] < str2[zhizhen8]) {
he = he + str2[zhizhen8];
str1[zhizhen8] = str2[zhizhen8] = 0;
sum++;
} else if (str2[zhizhen6] == str2[zhizhen8]) {
if (str1[zhizhen6] >= str1[zhizhen8]) {
he = he + str2[zhizhen6];
str1[zhizhen6] = str2[zhizhen6] = 0;
sum++;
} else {
he = he + str2[zhizhen8];
str1[zhizhen8] = str2[zhizhen8] = 0;
sum++;
}
}
}
void qushu(long long int n, long long int zhizhen1) {
long long int j = 0; //用以记录str4的个数
for (long long int k = zhizhen1; k < n; k++) {
if (str2[k] != 0) {
str4[j] = str3[k];
j++;
str4[j] = str5[k];
j++;
if (j >= 4)
break;
}
} //取出str2中的两位
}
long long int qinglingcsf(long long int n, long long int max) {
for (long long int i = 0; i < n; i++) {
if (str1[i] == max) {
str1[i] = str2[i] = 0;
zhizhen1 = i;
sum++;
break;
}
}
return zhizhen1;
}
long long int xunzuizhi(long long int n) {
long long int max = str1[0];
for (long long int i = 1; i <= n; i++) {
if (str1[i] > max) {
max = str1[i];
}
} //用以找到str1中的最大点
return max;
}
void shenrupaixvcsf(long long int n) {
for (long long int i = 0; i < n; i++) {
long long int geshu = 0;
long long int zhizhen;
while (str1[i] == str1[i + 1]) {
geshu = 2;
zhizhen = i;
for (long long int j = i + 1; j < n; j++) {
if (str1[j] == str1[j + 1]) {
geshu++;
} else
break;
}
if (geshu == 2) {
if (str2[i] < str2[i + 1]) {
long long int temp1 = str1[i + 1];
str1[i + 1] = str1[i];
str1[i] = temp1;
long long int temp2 = str2[i + 1];
str2[i + 1] = str2[i];
str2[i] = temp2;
long long int temp3 = str3[i + 1];
str3[i + 1] = str3[i];
str3[i] = temp3;
}
} else if (geshu > 2) {
for (long long int i = zhizhen; i < (zhizhen + geshu); i++) {
for (long long int j = (zhizhen + geshu - 1); j > i; j--) {
if (str1[j] > str1[j - 1]) {
long long int temp1 = str1[j];
str1[j] = str1[j - 1];
str1[j - 1] = temp1;
long long int temp2 = str2[j];
str2[j] = str2[j - 1];
str2[j - 1] = temp2;
long long int temp3 = str3[j];
str3[j] = str3[j - 1];
str3[j - 1] = temp3;
}
}
} //对整体的牌进行的内部的排序
}
i = i + geshu;
}
}
}
void paixvcsf(long long int n) {
for (long long int i = 0; i < n; i++) {
for (long long int j = n - 1; j > i; j--) {
if (str1[j] > str1[j - 1]) {
long long int temp1 = str1[j];
str1[j] = str1[j - 1];
str1[j - 1] = temp1;
long long int temp2 = str2[j];
str2[j] = str2[j - 1];
str2[j - 1] = temp2;
long long int temp3 = str3[j];
str3[j] = str3[j - 1];
str3[j - 1] = temp3;
}
}
} //对csf的牌从大到小进行排序,并联动数组1、2、3进行排序
}
void xiufu(long long int bug); //修复未知电脑bug函数
void xiufu(long long int bug) {
if (bug == 0)
str2[0] = str2[1];
}
void bianma(long long int n) {
for (long long int i = 0; i < n; i++) {
str3[i] = i + 1;
} //用str3对数组二从大到小进行编号
}
void shenrupaixv(long long int n) {
for (long long int i = 0; i < n; i++) {
long long int geshu = 0;
long long int zhizhen;
while (str2[i] == str2[i + 1]) {
geshu = 2;
zhizhen = i;
for (long long int j = i + 1; j < n; j++) {
if (str2[j] == str2[j + 1]) {
geshu++;
} else
break;
}
if (geshu == 2) {
if (str1[i] < str1[i + 1]) {
long long int temp1 = str1[i + 1];
str1[i + 1] = str1[i];
str1[i] = temp1;
long long int temp2 = str2[i + 1];
str2[i + 1] = str2[i];
str2[i] = temp2;
}
} else if (geshu > 2) {
for (long long int k = zhizhen; k < (zhizhen + geshu); k++) {
for (long long int l = (zhizhen + geshu - 1); l > i; l--) {
if (str1[l] > str1[l - 1]) {
long long int temp1 = str1[l];
str1[l] = str1[l - 1];
str1[l - 1] = temp1;
long long int temp2 = str2[l];
str2[l] = str2[l - 1];
str2[l - 1] = temp2;
}
}
} //对整体的牌进行的内部的排序
}
i = i + geshu;
}
}
}
void paixv(long long int n) {
for (long long int i = 0; i < n; i++) {
for (long long int j = n - 1; j > i; j--) {
if (str2[j] > str2[j - 1]) {
long long int temp1 = str1[j];
str1[j] = str1[j - 1];
str1[j - 1] = temp1;
long long int temp2 = str2[j];
str2[j] = str2[j - 1];
str2[j - 1] = temp2;
}
}
} //对cyy的牌从大到小进行排序
}
void yanzheng(long long int n) {
for (long long int i = 0; i < n; i++) {
printf("%lld %lld\n", str1[i], str2[i]);
}
}
void shuru(long long int n) {
for (long long int i = 0; i < n; i++) {
scanf("%lld", &str1[i]);
scanf("%lld", &str2[i]);
} //输入每张牌的a,b点数
}
int main() {
long long int n;
scanf("%lld", &n); //总牌数
long long int paishu = n / 2; //记录cyy要取的总牌数
shuru(n); //使用输入函数
paixv(n); //使用排序函数
shenrupaixv(n); //使用深入排序函数
bianma(n); //使用编码函数
xiufu(str2[0]); //使用修复电脑未知BUG函数
paixvcsf(n); //使用scf的排序函数
shenrupaixvcsf(n); //使用csf的深入排序函数
bianmacsf(n); //使用csf的编码函数
//
while (sum <= n) {
long long int max = xunzuizhi(n); //使用寻最值函数-寻找str1中最大的值
zhizhen1 = qinglingcsf(n, max); //使用csf的清零函数
if (str3[zhizhen1] <= paishu)
paishu++; //可取牌数大小的动态改变
qushu(n, zhizhen1); //使用取数函数
long long int zhizhen6 = str4[0];
long long int zhizhen7 = str4[1] - 1;
long long int zhizhen8 = str4[2];
long long int zhizhen9 = str4[3] - 1; // 6,8记录的是str2的序数;7,9记录的是str1的序数
if ((zhizhen6 <= paishu && zhizhen8 > paishu) || (zhizhen6 > paishu && zhizhen8 <= paishu)) {
case1(zhizhen7, zhizhen9); //使用一大一小牌处理函数
} else if (zhizhen6 <= paishu && zhizhen8 <= paishu) {
case2(zhizhen7, zhizhen9); //使用两个大牌函数
} else if (zhizhen6 > paishu && zhizhen8 > paishu) {
case3(zhizhen7, zhizhen9, n, paishu); //使用两张小牌的处理函数
}
}
printf("%lld\n", he);
return 0;
}
10
418429661 507737753
65169664 688434084
413093800 274858870
631767266 42769340
898214935 257992265
<100 bytes omitted>
用户输出
3775968953
系统信息
Exited with return code 0
10
261419711 381790741
395301464 109727004
59930794 897303752
3088137 384452998
958125214 871307598
<99 bytes omitted>
用户输出
2976613809
系统信息
Exited with return code 0
10
272820626 605064353
42452002 527776118
972100004 103698531
970919694 473147884
766382361 47804712
<99 bytes omitted>
用户输出
3008281256
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
10
665205051 427204195
710845907 763741672
770108551 603167371
630316362 77165788
55843477 686664883
<99 bytes omitted>
用户输出
3424507651
系统信息
Exited with return code 0
10
370117930 10356508
206440207 24034552
458210301 632865559
491222122 687287181
687518376 655230963
<100 bytes omitted>
用户输出
2538307731
系统信息
Exited with return code 0
10
139976 593656460
723986671 363424724
1380273 28180744
408184158 741160744
281059907 629774070
642
<95 bytes omitted>
用户输出
3441059724
系统信息
Exited with return code 0
1000
661330356 52985058
911549339 118926429
807317539 459347150
992990256 125679776
996241486 822802
<19613 bytes omitted>
用户输出
280595725745
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
565256379 461020479
586329353 20119014
704616001 387799623
671532884 883210479
19037978 7054035
<19589 bytes omitted>
用户输出
302015647012
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
459961701 778863108
184807385 131922901
981443367 130232010
858676237 295402608
970097732 64695
<19597 bytes omitted>
用户输出
286041773642
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
814981411 458887084
170493152 194098923
473222527 856427999
862026089 664018822
78094868 152144
<19613 bytes omitted>
用户输出
296118988842
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
998911939 14469580
801910454 835524235
924052809 151599226
906225034 728418914
509755094 338138
<19592 bytes omitted>
用户输出
286863983002
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
483991898 501892083
777360399 190443766
528271572 849071211
834112216 565841714
592931589 50914
<19616 bytes omitted>
用户输出
298005770839
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
662901492 757792097
22571113 205360684
341580811 497412615
141460200 418808285
281598247 518331
<19623 bytes omitted>
用户输出
291153175977
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
3021544 383844645
150777033 75965531
173194118 287932285
931104466 964593235
69625941 905448292
<19569 bytes omitted>
用户输出
296714423543
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
445016789 239644846
872436348 575307044
330232101 137239592
216342997 88891199
18780554 8558978
<19613 bytes omitted>
用户输出
299206192004
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
163988884 92515928
93417639 739319950
725416124 379155836
206222379 920981728
513989916 3549671
<19599 bytes omitted>
用户输出
291483900524
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
358875965 620163043
971597723 976962388
174534894 733898703
477415518 452255158
594800521 28882
<19621 bytes omitted>
用户输出
301741328570
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000
881418187 750110566
315493938 282606189
699540817 761508637
293832807 238994173
43805780 899199
<19585 bytes omitted>
用户输出
287974951864
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000
54371547 36495877
591025884 46108328
160800309 868200825
637021838 76173428
413626379 9811729
<1968958 bytes omitted>