提出 #14814724


ソースコード 拡げる

#include <bits/stdc++.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool change(T& a, T b) { if (a != b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;

int c[1000];
int s[1000][1000];
int t[1000];
int last[1000];

int d,n;

void calc(){
    ll hpn=0;
    for(int i=1;i<=d;i++){
        hpn+=s[i][t[i]];
        last[t[i]]=i;
        for(int j=1;j<=n;j++){
            hpn-=c[j]*(i-last[j]);
        }
        cout << max(1000000+hpn,0LL) << endl;
    }
    
}

void solve(){
    //方針:それぞれの日に関して(得る得点)-(失う得点)を最大化する
    for(int i=1;i<=d;i++){
        //hpn+=s[i][t[i]];
        //last[t[i]]=i;
        int maxt=-1,maxsc=-10000000;
        for(int j=1;j<=n;j++){
            if(chmax(maxsc,s[i][j]+c[j]*(i-last[j]))) maxt=j;
        }
        t[i]=maxt;
    }
    
}

void input(){
    cin >> d;
    n=26;
    for(int i=1;i<=n;i++) cin >> c[i];
    for(int i=1;i<=d;i++)
        for(int j=1;j<=n;j++){cin >> s[i][j];}    
    for(int i=1;i<=d;i++) cin >> t[i];
    //cout << calc() << endl;
}

void puts(){
    for(int i=1;i<=d;i++) cout << t[i] << endl;
}

int main(){
    input();
    //solve();
    calc();
    //puts();
    return 0;
}

提出情報

提出日時
問題 B - Scoring
ユーザ nagoriyuki
言語 C++ (GCC 9.2.1)
得点 0
コード長 1447 Byte
結果 WA
実行時間 12 ms
メモリ 4956 KiB

ジャッジ結果

セット名 test_ALL
得点 / 配点 0 / 1
結果
WA × 5
セット名 テストケース
test_ALL test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt
ケース名 結果 実行時間 メモリ
test_00.txt WA 12 ms 4952 KiB
test_01.txt WA 12 ms 4828 KiB
test_02.txt WA 12 ms 4956 KiB
test_03.txt WA 8 ms 4868 KiB
test_04.txt WA 9 ms 4884 KiB