結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー BantakoBantako
提出日時 2017-07-27 19:05:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 1,555 bytes
コンパイル時間 1,198 ms
コンパイル使用メモリ 160,752 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-18 08:55:34
合計ジャッジ時間 3,411 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 6 ms
6,944 KB
testcase_04 AC 8 ms
6,940 KB
testcase_05 AC 58 ms
6,940 KB
testcase_06 AC 64 ms
6,940 KB
testcase_07 AC 30 ms
6,944 KB
testcase_08 AC 43 ms
6,944 KB
testcase_09 AC 73 ms
6,944 KB
testcase_10 AC 7 ms
6,940 KB
testcase_11 AC 9 ms
6,940 KB
testcase_12 AC 25 ms
6,944 KB
testcase_13 AC 64 ms
6,944 KB
testcase_14 AC 83 ms
6,940 KB
testcase_15 AC 11 ms
6,940 KB
testcase_16 AC 12 ms
6,940 KB
testcase_17 AC 8 ms
6,940 KB
testcase_18 AC 5 ms
6,940 KB
testcase_19 AC 70 ms
6,944 KB
testcase_20 AC 75 ms
6,944 KB
testcase_21 AC 16 ms
6,940 KB
testcase_22 AC 13 ms
6,944 KB
testcase_23 AC 13 ms
6,940 KB
testcase_24 AC 47 ms
6,940 KB
testcase_25 AC 66 ms
6,944 KB
testcase_26 AC 21 ms
6,940 KB
testcase_27 AC 21 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:7:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     for(int i = 0;i < N;i++)scanf("%d",&L[i]);
      |                             ~~~~~^~~~~~~~~~~~
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d",&T);
      |     ~~~~~^~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%s%*c%c",S,&c);
      |         ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
int count[26];
main(){
    char name[4000][17];
    int N,T,L[26],point[4000][28],num=0;//point[26]は最後の提出//27は合計
    scanf("%d",&N);
    for(int i = 0;i < N;i++)scanf("%d",&L[i]);
    scanf("%d",&T);
    for(int i = 0;i < T;i++){
        char S[17],c;
        scanf("%s%*c%c",S,&c);
        for(int j = 0;j < 4000;j++){
            if(!strcmp(name[j],S)){
                point[j][c-'A'] = 50*L[c-'A']+500*L[c-'A']/(8+(++count[c-'A'])*2);
                point[j][26] = i;
                point[j][27] += point[j][c-'A'];
                goto skip;
            }
        }
        strcpy(name[num],S);
        point[num][c-'A'] = 50*L[c-'A']+500*L[c-'A']/(8+(++count[c-'A'])*2);
        point[num][26] = i;
        point[num][27] = point[num][c-'A'];
        num++;
        skip:i += 0;
    }
    int number[4000],last[4000],sum[4000];
    for(int i = 0;i < num;i++){
        number[i] = i;
        last[i] = point[i][26];
        sum[i] = point[i][27];
    }
    using std::swap;
    for(int i = 0;i < num;i++){
        for(int j = i+1;j < num;j++){
            if(sum[i] < sum[j] ||
                (sum[i] == sum[j] && last[i] > last[j])){
                swap(sum[i],sum[j]);
                swap(last[i],last[j]);
                swap(number[i],number[j]);
            }
        }
    }
    for(int i = 0;i < num;i++){
        printf("%d %s",i+1,name[number[i]]);
        for(int j = 0;j < N;j++){
            printf(" %d",point[number[i]][j]);
        }
        printf(" %d\n",point[number[i]][27]);
    }
}
0