编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#46141 #1002. B. 说服合伙人 Wrong Answer 0 83 ms 408 K C / 6.3 K 2020-08-18 21:17:47
显示原始代码
#define _CAT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
    long long int n;
    scanf("%lld", &n);  //总牌数

    long long int str1[100] = { 0 }, str2[100] = { 0 }, str3[100] = { 0 }, str4[100] = { 0 },
                  str5[100] = { 0 };  // str1记录所有a;str2记录所有b;

    for (long long int i = 0; i < n; i++) {
        scanf("%lld", &str1[i]);
        scanf("%lld", &str2[i]);
    }  //输入每张牌的a,b点数

    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的牌从大到小进行排序

    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 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;
                        }
                    }
                }  //对整体的牌进行的内部的排序
            }
        }
        i = i + geshu;
    }

    for (long long int i = 0; i < n; i++) {
        str3[i] = i + 1;
    }  //用str3对数组二从大到小进行编号

    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进行排序

    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;
    }

    long long int zhizhen1 = 0;    //设置指针1
    long long int paishu = n / 2;  //记录cyy要取的总牌数
    long long int sum = 0;         //用以记录已经处理过的牌数
    long long int he = 0;          //设置cyy的和

    long long int k = 0;  //用以记录str5的个数

    while (sum <= n) {
        long long int max = str1[0];
        for (long long int i = 1; i <= n; i++) {
            if (str1[i] > max) {
                max = str1[i];
            }
        }  //用以找到str1中的最大点

        for (long long int i = 0; i < n; i++) {
            if (str1[i] == max) {
                str1[i] = str2[i] = 0;
                zhizhen1 = i;
                sum++;
                break;
            }
        }

        if (str3[zhizhen1] <= paishu)
            paishu++;

        long long int j = 0;  //用以记录str4的个数

        for (long long int i = zhizhen1; i < n; i++) {
            if (str2[i] != 0) {
                str4[j] = str3[i];
                j++;
                if (j >= 2)
                    break;
            }
        }  //取出str2中的两位

        long long int zhizhen6 = str4[0];
        long long int zhizhen8 = str4[1];

        if ((str3[zhizhen6] <= paishu && str3[zhizhen8] > paishu) ||
            (str3[zhizhen6] > paishu && str3[zhizhen8] <= paishu)) {
            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++;
                }
            }
        } else if (str3[zhizhen6] <= paishu && str3[zhizhen8] <= paishu) {
            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[zhizhen8] = 0;
                    sum++;
                } else {
                    he = he + str2[zhizhen8];
                    str1[zhizhen8] = str2[zhizhen8] = 0;
                    sum++;
                }
            }
        } else if (str3[zhizhen6] > paishu && str3[zhizhen8] > paishu) {
            for (long long int i = zhizhen8; i < n; i++) {
                if (str3[i] <= paishu) {
                    he = he + str2[i];
                    str1[i] = str2[i] = 0;
                    sum++;
                    break;
                }
            }
        }
    }

    printf("%lld", he);
}
子任务 #1
Wrong Answer
得分:0
测试点 #1
Wrong Answer
得分:0
用时:3 ms
内存:236 KiB

输入文件(1.in

10
418429661 507737753
65169664 688434084
413093800 274858870
631767266 42769340
898214935 257992265
<100 bytes omitted>

答案文件(1.ans

3775968953

用户输出

2313260370

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #2
Wrong Answer
得分:0
用时:3 ms
内存:352 KiB

输入文件(2.in

10
261419711 381790741
395301464 109727004
59930794 897303752
3088137 384452998
958125214 871307598

<99 bytes omitted>

答案文件(2.ans

2976613809

用户输出

2002942809

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #3
Wrong Answer
得分:0
用时:3 ms
内存:280 KiB

输入文件(3.in

10
272820626 605064353
42452002 527776118
972100004 103698531
970919694 473147884
766382361 47804712
<99 bytes omitted>

答案文件(3.ans

3536057374

用户输出

1048164432

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #4
Wrong Answer
得分:0
用时:3 ms
内存:288 KiB

输入文件(4.in

10
665205051 427204195
710845907 763741672
770108551 603167371
630316362 77165788
55843477 686664883
<99 bytes omitted>

答案文件(4.ans

3424507651

用户输出

1851283639

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #5
Wrong Answer
得分:0
用时:3 ms
内存:312 KiB

输入文件(5.in

10
370117930 10356508
206440207 24034552
458210301 632865559
491222122 687287181
687518376 655230963
<100 bytes omitted>

答案文件(5.ans

2538307731

用户输出

1333022807

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #6
Wrong Answer
得分:0
用时:3 ms
内存:224 KiB

输入文件(6.in

10
139976 593656460
723986671 363424724
1380273 28180744
408184158 741160744
281059907 629774070
642
<95 bytes omitted>

答案文件(6.ans

3441059724

用户输出

1964591274

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #7
Runtime Error
得分:0
用时:7 ms
内存:320 KiB

输入文件(7.in

1000
661330356 52985058
911549339 118926429
807317539 459347150
992990256 125679776
996241486 822802
<19613 bytes omitted>

答案文件(7.ans

355227453468

系统信息

Killed: Segmentation fault
测试点 #8
Runtime Error
得分:0
用时:3 ms
内存:304 KiB

输入文件(8.in

1000
565256379 461020479
586329353 20119014
704616001 387799623
671532884 883210479
19037978 7054035
<19589 bytes omitted>

答案文件(8.ans

365177459148

系统信息

Killed: Segmentation fault
测试点 #9
Runtime Error
得分:0
用时:3 ms
内存:268 KiB

输入文件(9.in

1000
459961701 778863108
184807385 131922901
981443367 130232010
858676237 295402608
970097732 64695
<19597 bytes omitted>

答案文件(9.ans

367395134873

系统信息

Killed: Segmentation fault
测试点 #10
Runtime Error
得分:0
用时:3 ms
内存:324 KiB

输入文件(10.in

1000
814981411 458887084
170493152 194098923
473222527 856427999
862026089 664018822
78094868 152144
<19613 bytes omitted>

答案文件(10.ans

373426427328

系统信息

Killed: Segmentation fault
测试点 #11
Runtime Error
得分:0
用时:8 ms
内存:324 KiB

输入文件(11.in

1000
998911939 14469580
801910454 835524235
924052809 151599226
906225034 728418914
509755094 338138
<19592 bytes omitted>

答案文件(11.ans

363022583108

系统信息

Killed: Segmentation fault
测试点 #12
Runtime Error
得分:0
用时:4 ms
内存:292 KiB

输入文件(12.in

1000
483991898 501892083
777360399 190443766
528271572 849071211
834112216 565841714
592931589 50914
<19616 bytes omitted>

答案文件(12.ans

371749479674

系统信息

Killed: Segmentation fault
测试点 #13
Runtime Error
得分:0
用时:6 ms
内存:320 KiB

输入文件(13.in

1000
662901492 757792097
22571113 205360684
341580811 497412615
141460200 418808285
281598247 518331
<19623 bytes omitted>

答案文件(13.ans

362531049289

系统信息

Killed: Segmentation fault
测试点 #14
Runtime Error
得分:0
用时:5 ms
内存:408 KiB

输入文件(14.in

1000
3021544 383844645
150777033 75965531
173194118 287932285
931104466 964593235
69625941 905448292
<19569 bytes omitted>

答案文件(14.ans

370976268028

系统信息

Killed: Segmentation fault
测试点 #15
Runtime Error
得分:0
用时:3 ms
内存:320 KiB

输入文件(15.in

1000
445016789 239644846
872436348 575307044
330232101 137239592
216342997 88891199
18780554 8558978
<19613 bytes omitted>

答案文件(15.ans

362348876183

系统信息

Killed: Segmentation fault
测试点 #16
Runtime Error
得分:0
用时:7 ms
内存:232 KiB

输入文件(16.in

1000
163988884 92515928
93417639 739319950
725416124 379155836
206222379 920981728
513989916 3549671
<19599 bytes omitted>

答案文件(16.ans

366993496399

系统信息

Killed: Segmentation fault
测试点 #17
Runtime Error
得分:0
用时:3 ms
内存:328 KiB

输入文件(17.in

1000
358875965 620163043
971597723 976962388
174534894 733898703
477415518 452255158
594800521 28882
<19621 bytes omitted>

答案文件(17.ans

366287482640

系统信息

Killed: Segmentation fault
测试点 #18
Runtime Error
得分:0
用时:7 ms
内存:276 KiB

输入文件(18.in

1000
881418187 750110566
315493938 282606189
699540817 761508637
293832807 238994173
43805780 899199
<19585 bytes omitted>

答案文件(18.ans

364052501500

系统信息

Killed: Segmentation fault
测试点 #19
Runtime Error
得分:0
用时:3 ms
内存:296 KiB

输入文件(19.in

100000
54371547 36495877
591025884 46108328
160800309 868200825
637021838 76173428
413626379 9811729
<1968958 bytes omitted>

答案文件(19.ans

36515398244123

系统信息

Killed: Segmentation fault
测试点 #20
Runtime Error
得分:0
用时:3 ms
内存:324 KiB

输入文件(20.in

100000
205682121 440732555
964831849 3518501
907901094 917800328
145684506 659607179
272486711 88437
<1969170 bytes omitted>

答案文件(20.ans

36611673815071

系统信息

Killed: Segmentation fault